Skip to content

Instantly share code, notes, and snippets.

@fdzuluaga2020
Last active September 17, 2022 03:30
Show Gist options
  • Save fdzuluaga2020/fb67154205b6a3559fce189fd1f990fe to your computer and use it in GitHub Desktop.
Save fdzuluaga2020/fb67154205b6a3559fce189fd1f990fe to your computer and use it in GitHub Desktop.
NAVICAT PREMIUM 15
SQL | DDL, DQL, DML, DCL and TCL Commands
Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks.
These SQL commands are mainly categorized into four categories as:
DDL – Data Definition Language
DQl – Data Query Language
DML – Data Manipulation Language
DCL – Data Control Language
Though many resources claim there to be another category of SQL clauses TCL – Transaction Control Language. So we will see in detail about TCL as well.
------------------------------------------------------------------------------------------------------------------------------------
DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database.
Examples of DDL commands:
CREATE – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).
DROP – is used to delete objects from the database.
ALTER-is used to alter the structure of the database.
TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed.
COMMENT –is used to add comments to the data dictionary.
RENAME –is used to rename an object existing in the database.
------------------------------------------------------------------------------------------------------------------------------------
DQL (Data Query Language) :
DQL statements are used for performing queries on the data within schema objects. The purpose of DQL Command is to get some schema relation based on the query passed to it.
Example of DQL:
SELECT – is used to retrieve data from the a database.
------------------------------------------------------------------------------------------------------------------------------------
DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements.
Examples of DML:
INSERT – is used to insert data into a table.
UPDATE – is used to update existing data within a table.
DELETE – is used to delete records from a database table.
------------------------------------------------------------------------------------------------------------------------------------
DCL(Data Control Language) : DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system.
Examples of DCL commands:
GRANT-gives user’s access privileges to database.
REVOKE-withdraw user’s access privileges given by using the GRANT command.
------------------------------------------------------------------------------------------------------------------------------------
TCL(transaction Control Language) : TCL commands deals with the transaction within the database.
Examples of TCL commands:
COMMIT– commits a Transaction.
ROLLBACK– rollbacks a transaction in case of any error occurs.
SAVEPOINT–sets a savepoint within a transaction.
SET TRANSACTION–specify characteristics for the transaction.
Primero hay que instalar el Xampp
Luego hay que crear un usuario y un password, ese usuario es diferente al del root para que deje conectar
Ver :
How To Connect To MySQL Server After Install XAMPP On Mac OS.pdf
How to Fix Error 403 _Forbidden Access_ New XAMPP security concept_ on MacBook - DEV.pdf
Unicados en /articles/xampp
---------------------------------------------------------------------------------------------------------------------------------
Parametros de Conexion :
Connection Name : 192.168.64.2_3306_COBO
Host : 192.168.64.2
Port : 3306
Username : cobo
Password : xxxxxx
---------------------------------------------------------------------------------------------------------------------------------
Conexion de Prueba del Software :
Testing Account
Navicat provides evaluated accounts for testing purpose.
MySQL
Host: server1.navicat.com
Port: 4406
User Name: navicat
Password: testnavicat
Se baja la base de datos de Github :
https://github.com/jpwhite3/northwind-MySQL
Se baja la totalidad de los archivos como un .zip
Se instala en el PHPMyAdmin
En la Opcion de Import se selecciona :
1. northwind.sql : se importa y se ejecuta (GO), en este paso se crea toda la base y todas sus tablas
2. northwind-data.sql : se importa y se ejecuta (GO), en este paso se cargan los datos a la estructura de la base
Listo!!!!.....se accesa la base desde Navicat
Interface :
1 - Main Toolbar : La barra superior del programa : Connections, Users, Tables, Collections,Backups, Automatization,...
2 - Navigation Pane : Panel a la Izquierda del programa : Database & Database Objects Navigation
3 - Tab Bar : Barra situada inmediatamente abajo de Main ToolBar, muestra en pestañas las opciones abiertas
4 - Object ToolBar : Barra situada inemediatamente abajo del Tab Bar, muestra los comandos para el objeto seleccionado
5 - Object Pane : Es el panel Central que muestra la lista de objetos tales como tablas y tabbed windows
6 - Information Pane : Es el panel situado a la derecha del programa, muestra informacion detallada del objeto seleccionado
7 - Status Bar : Situada en la parte Inferior de programa, muestra informacion en funcion del objeto seleccionado
-----------------------------------------------------------------------------------------------------------------------------------
Navigation Pane : es el panel izquierdo en donde se encuentran toda la informacion referente a :
Conexiones
Bases de Datos
Objetos de las Bases de Datos
En la parte inferior del panel junto al cuadro de busqueda esta el icono de Conectado / Desconectadoc:
Esta opcion permite alternar la vista entre mostrar todas los objetos de las Bases de Datos o solo aquellos que se encuentren conectados
-----------------------------------------------------------------------------------------------------------------------------------
Object Pane : se encuentra en la parte central de la aplicacion y es donde se visualizan los objetos con los cuales se este trabajando tales como Tablas de Datos, Vistas, Etc.
Siempre hay la opcion de visualizarlos como :
Lista : solo lista de los objetos
Lista Detallada : lista de los objetos incluyendo sus atributos
ER Diagram : si existen tablas en la base la aplicacion genera automaticamente el diagrama
-----------------------------------------------------------------------------------------------------------------------------------
Table :
Empty Table : me permite vaciar la tabla conservando la informacion del AutoIncrement, es decir sin resetearla
Truncate Table : Idem al anterior solo que resetea el AutoIncrement
Open Table - Table Viewer: me permite importar, exportar, ver como grid, como formulario, sort, filter, adicionar, insertar y borrar registros.
Table Design : me permite adicionar, importar, borrar y reorganizar campos dentro de la tabla, asi como Foreign Keys & Indexes
Puedo buscar informacion activando la barra de busqueda con COMMAND F tanto en Open Table como en Table Design
Me permite ver un conjunto de tablas como si fueran una sola, basicamente a traves de Querys y Joins
--------------------------------------------------------------------------------------------------------------------------------
Exportacion de Datos :
Me permite exportar la informacion de las vistas :
- txt
- csv
- HTML
- xls
- xlsx
- sql
- xml
- json
--------------------------------------------------------------------------------------------------------------------------------
Creacion de Vistas :
Las vistas las creo con el SQL Editor en donde puedo digitar el codigo sql requerido
Tambien puedo usar el Query Builder en donde graficamente :
- Agrego las tablas de las que quiero obtener la informacion
- Determino si el SELECT debe incluir registros DISTINCT o no
- Selecciono los campos con (+) donde tambien puedo usar funciones agregadas (SUM,MAX,MIN,AVG,COUNT)
- Puedo agregar filtros WHERE
- Puedo agregar agrupaciones GROUP BY
- Puedo agregar clausulas HAVING para el caso de los datos agregados
- Puedo agregar sort con ORDER BY
- Puedo agregar un limite a la consulta con LIMIT
El codigo generado lo puedo ver en el SQL Editor y lo puedo formatear automaticamente para mayor legibilidad y profesionalismo en con el asistente de Beautifu SQL
Adicionalmente tengo la opcion en el SQL Editor de autocompletar el codigo, a medida que vaya escribiendo se abre una ventana con las diferentes posibles opciones que puedo usar, simplemente selecciono la que deseo y la inserto presionando TAB
--------------------------------------------------------------------------------------------------------------------------------
Replace :
La barra de reemplazo se invonca con OPTION + COMMAND + F, ahi se introduce el texto a buscar y el texto a reemplazar.
-----------------------------------------------------------------------------------------------------------------------------------
Search and Replace
La barra de reemplazo siempre tiene la opcion de convertirse en busqueda y viceversa
Si hago click en la lupa de cualquiera de las dos barras tengo las siguientes opciones :
Option Description
Regular Expression Search regular expressions.
Match Case Enable case sensitive search.
Whole Words Return the objects that match the entire word of the search string.
-----------------------------------------------------------------------------------------------------------------------------------
Zoom :
In : COMMAND +
Out : COMMAND -
Reset : COMMAND 0
-----------------------------------------------------------------------------------------------------------------------------------
Haciendo click derecho sobre el codigo seleccionado puedo automaticamente crear el Snippet del codigo
Para usar el Query Builder :
- Selecciono las tablas para que aparezcan en el panel central
- Llamo la opcion de Query y ahi me voy a al Query Builder seleccionando el icono del Martillo
- Ya en el Query Builder selecciono las tablas de las que voy a extraer la informacion
- La seleccion la puedo hacer con el mouse, o con Drag & Drop
- Sobre cada tabla seleccionada puedo editar el Alias de la Tabla simplemente tocando el Titulo
- Tambien con el Boton Derecho puedo remover la tabla, seleccionar todos los campos, deseleccionarlos todos, refresh
- Cuando adiciono campos al Select del Query Builder tambien es posible colocarle Alias a los campos
- En la seleccion de los campos puedo incluir operaciones de agregacion tales como : SUM, MAX, MIN, AVG, COUNT
La asociacion de las tablas se realiza de manera automatica basada en la definicion de FK de la tabla Hija hacia la tabla Padre, si se quiere se puede hacer asociacion manual arrastrando el campo desde la tabla Hija hasta conectarlo con el campo deseado en la tabla Padre
La asociacion de las tablas tiene dos vistas :
- Field Relation : que me permite ver la asociacion de los campos propiamente dichos
- Table Relation : que me permite ver la asociacion de las tablas en si misma
El default de todo Join es el Inner Join, es decir la interseccion de ambas tablas
En la vista de Table Relation puedo llamar el icono de conjuntos entre las dos tablas para modificar el tipo de Join
Con el click derecho sobre el codigo de FROM puedo llamar el menu :
The pop-up menu options of the FROM tab:
Option Description
Insert Add an identifier, an expression or a subquery.
Insert Bracket Add a pair of parentheses.
Remove Remove the identifier, expression or subquery.
Clear and Convert to USING Clause Remove the ON condition and convert it to USING clause.
Clear and Convert to ON Clause Remove the USING condition and convert it to ON clause.
Group with Bracket Add parentheses to group the selected conditions.
Ungroup Remove the parentheses.
----------------------------------------------------------------------------------------------------------------------------------------
Cuando Quiero Filtrar los Datos uso la clausula WHERE :
Con el click derecho sobre el codigo de WHERE puedo llamar el menu :
The pop-up menu options of the WHERE tab:
Option Description
Toggle Negator Reverse the meaning of the condition.
Insert Add a condition.
Insert Custom Add a custom condition.
Insert Bracket Add a pair of parentheses.
Remove Remove the condition.
Group with Bracket Add parentheses to group the selected conditions.
Ungroup Remove the parentheses.
Puedo determinar opciones de agrupamiento con GROUP BY, para el caso de funciones agrupadas como SUM, MIN, MAX, AVG, COUNT no se puede usar el GROUP BY, este debe ser reemplazado por HAVING
Es decir que HAVING me permite filtrar datos sumarizados por cualquiera de las funciones agregadas
Sobre el codigo del HAVING puedo hacer click derecho para acceder al menu :
The pop-up menu options of the HAVING tab:
Option Description
Toggle Negator Reverse the meaning of the condition.
Insert Add a condition.
Insert Custom Add a custom condition.
Insert Bracket Add a pair of parentheses.
Remove Remove the condition.
Group with Bracket Add parentheses to group the selected conditions.
Ungroup Remove the parentheses.
-----------------------------------------------------------------------------------------------------------------------------------------
Puedo ordenar los resultados del Query con las opciones de ORDER BY que basicamente son ascendentemente o descendentemente
-----------------------------------------------------------------------------------------------------------------------------------------
Por ultimo puedo limitar el numero de resultados a obtener con LIMIT :
Aca existen dos opciones :
- Offset : especifica el numero de registros a ser evitados o pasados por alto
- Limit : especifica el numero de registros a ser visualizado
Subqueries :
En la opcion de FROM puedo en el (+) incluir una Expression o un Subquery
En el caso del Subquery, se genera la tabla en la vista de tablas, arriba de la tabla esta el icono del martillo para usar el Query Builder para construir el subquery.
En la barra superior esta la opcion para volver al query principal
El concepto de Data Modeling hace referencia al uso de Diagramas Entidad - Relacion ( ER Diagrams) que es una representacion de la Estructura de Datos empleada en una Base de Datos.
Los componentes de un ERD son :
- Entities : son las Tablas y Vistas de la BD, cada entidad esta conformada por instancias, asi por ejemplo cada registro o cada fila de una tabla es una instancia de la entidad que es la tabla en si misma. En otras palabras una Instancia es una representacion especifica de la Entidad
- Attributes : los atributos son facts o descripciones de las entidades, por lo general se convierten en columnas de la tabla, asi mismo son atributos la PK y las FK
- Relationships : describen la manera como se relacionan las tablas de la base de datos
- Cardinality : define el tipo de relacion de las tablas en funcion del numero de ocurrencias en una entidad con respecto al numero de ocurrencias en otra entidad
---------------------------------------------------------------------------------------------------------------------------------------
Tipos de Modelos :
Conceptual model vs Logical model vs Data model:
ERD feature Conceptual Logical Physical
Entity (name) Yes Yes Yes
Relationship Yes Yes Yes
Column Yes Yes
Column’s Type Optional Yes
Primary Key Yes
Foreign Key Yes
---------------------------------------------------------------------------------------------------------------------------------------
En Resumen :
- Modelo Conceptual : Establece las entidades, sus atributos y sus relaciones
- Modelo Logico : Define la estructura de los Data Elements y define las relaciones entre ellos
- Modelo Fisico : Establece la implementacion especifica en la Base de Datos del Data Model
Modelo Conceptual : en este modelo se establece cuales son las entidades que existen y el tipo de relacion que existe entre ellas mas no define cuales son las tablas que debe tener la base de datos
Modelo Logico : el modelo logico es una version detallada del modelo conceptual, en el se definen explicitamente las columnas para cada entidad, ademas introduce entidades transaccionales y operacionales.
Modelo Fisico : representa en si mismo el plano de la base de datos relacional, el modelo fisico se construye a partir del modelo logico especificando para cada columna el tipo de datos, la extension del campo, si es nullable, etc
----------------------------------------------------------------------------------------------------------------------------------------
Modelo Conceptual : Defines WHAT the system contains
Modelo Logico : Defines HOW the system should be implemented REGARDLESS DBMS
Modelo Fisico : Defines HOW the system shoud be implemented in a SPECIFIC DMS
---------------------------------------------------------------------------------------------------------------------------------------
La cardinalidad me define el numero de valores diferentes en un columna con respecto al numero de valores totales, asi por ejemplo en una tabla de ordenes de compra el codigo de la orden tendra una cardinalidad muy alta ya qye cada orden tendra un codigo unico, maxime si este campo se escoje como PK, pues no podra tener valores repetidos. La cardinalidad por ejemplo de los productos ordenados sera menor pues es muy posible que se repitan las ordenes para los mismos productos con mucha frecuencia.
--------------------------------------------------------------------------------------------------------------------------------------
En Modelacion la cardinalidad define el tipo de relacion que existe entre las tablas
RELATIONSHIP : One-to-one
EXAMPLE : person ←→ birth certificate
LEFT : 1
RIGHT : 1
NARRATIVE : A person must have its own birth certificate
--------------------------------------------------------------------------------------------------------------------------------------
RELATIONSHIP : One-to-one (optional on one side)
EXAMPLE : person ←→ driving license
LEFT : 1
RIGHT : 0..1 or ?
NARRATIVE : A person may have a driving license
--------------------------------------------------------------------------------------------------------------------------------------
RELATIONSHIP : Many-to-one
EXAMPLE : person ←→ birthplace
LEFT : 1..* or +
RIGHT : 1
NARRATIVE : Many people can be born at the same place
--------------------------------------------------------------------------------------------------------------------------------------
RELATIONSHIP : Many-to-many (optional on both sides)
EXAMPLE : person ←→ book
LEFT : 0..* or *
RIGHT : 0..* or *
NARRATIVE : A person may own books
--------------------------------------------------------------------------------------------------------------------------------------
RELATIONSHIP : One-to-many
EXAMPLE : order ←→ line item
LEFT : 1
RIGHT : 1..* or +
NARRATIVE : An order contains at least one item
--------------------------------------------------------------------------------------------------------------------------------------
RELATIONSHIP : Many-to-many
EXAMPLE : course ←→ student
LEFT : 1..* or +
RIGHT : 1..* or +
NARRATIVE : Students follow various courses
Manejar las relaciones de tipo :
- One to One
- One to Many
Es relativamente simple, ya que simplemente basta con adicionar el PK de la Tabla Padre o Referenced en la Tabla Hija o Referencing como FK
De hecho una tabla puede tener multiples FK, pero solo puede tener una PK
No hay que confundir el hecho de que la PK sea compuesta por varios campos con que existan multiples PK, asi la PK sea compuesta por multiples campos, en realidad solo existe una PK
--------------------------------------------------------------------------------------------------------------------------------------
Lo que no es tan simple es manejar relaciones del tipo Many to Many como por ejemplo :
- Libros y Autores : en este ejemplo un mismo autor puede escribir varios libros y un mismo libro puede ser escrito por varios autores.
- Estudiantes y Clases : un estudiante puede asistir a varias clases y a una misma clase pueden ir varios estudiantes
Para manejar estos casos de las relaciones Many to Many se usa una Tercera Tabla denominada :
- Joining Table
- Bridging Table
En esta tabla se almacena un registro por cada combinacion de las tablas que conforman la relacion Many to Many
Asi por ejemplo para el caso de las Clases y los Estudiantes :
La Joining Table luciria asi :
STUDENT ID CLASS ID
1 3
1 5
1 9
2 1
2 4
2 5
2 9
Esta tabla sera una Tabla Intermedia entre la Tabla de Estudiantes y la Tabla de Clases
Me permite crear modelos de la base de datos :
- Modelos Conceptuales
- Modelos Logicos
- Modelos Fisicos
Adicionalmentese puede hacer Ingenieria Inversa de Schemas, Tablas o Vistas de un Modelo Fisico
Tambien se puede generar a partir de un Modelo Fisico un Archivo de SQL o un Database / Schema
Todos los modelos se graban dentro de la libreria de Navicat, no obstante se pueden grabar de manera independiente
En la pantalla de modelacion se va a File : Save As External File y se escoge el directorio deseado
Los modelos gravados de manera externa pueden ser abiertos nuevamente desde la pantalla principal en el menu de File : Open External File : Model
La extension empleada para guardar los modelos es .ndm2
----------------------------------------------------------------------------------------------------------------------------------------
Model Window :
Un Modelo puede estar compuesto por varios Diagramas, cada diagrama se selecciona de la opcion de Diagrama de la barra superior
Interfaz :
1 - ToolBar : situada en la parte superior, presenta opciones en funcion del tipo de modelo : Conceptual, Logico o Fisico
2 - Explorer Pane : situado en la parte superior izquierda, presenta todas las tablas y vistas empleadas en el modelo
3 - History Pane : situado en la parte inferior izquierda, muestra la historia de acciones para hacer Undo sofisticado
4 - Properties Pane : situado en la parte superior derecha, ahi estan todas las propiedades de los elementos del modelo
5 - OveView Pane : situado en la parte inferior derecha, se muestra todo el canvas, COMMAND (+,-,0)
6 - Diagram Canvas : es donde aparece propiamente dicho el modelo
Property Pane Options
Option Description
Begin Style The style of the arrow's back.
Black and white Check this box to change the diagram color to black and white.
Bold Check this box or press COMMAND-B to bold the table, view, entity, foreign key, relation or shape.
Border Color The color of the shape's border.
Cap Style The cap style of the line/arrow.
Cardinality The foreign key/relation cardinality of the table/entity.
Case Sensitive The case sensitivity of the table or view names. Available only for MySQL and MariaDB models.
Color The color of the object.
Dash Style The dash style of the line/arrow.
Database The database server type of the model.
Database Version The database version of the model.
Default Database The default database of the model.
Default Schema The default schema of the model.
End Style The style of the arrow's front.
Entity Font The font and font size of tables/entities.
Font The font and font size of notes, labels or layers.
Font Color The font color of notes, labels or layers.
Join Style The join style of the line/arrow.
Model Type The type of the model.
Model Version The version of the model.
Name The name of the object.
Notation The notation of the diagram. The notation options are depended on the model type.
Note Style The style of the note. The value for this can be Note or Label.
Opacity The transparency of the image/shape.
Pages The width and height of the diagram (number of papers).
Position The number of pixels from the object to the left side (X) and the top (Y) of the canvas.
Referenced The referenced (parent) table, view or entity.
Referencing The referencing (child) table, view or entity.
Schema The database/schema name of the table/view.
Show entity comments Check this box to show the entity comments in the diagram.
Show field comments Check this box to show the field comments in the diagram.
Show name Check this box to show the name of the foreign key, relation or shape.
Show schema name Check this box to show the database/schema names of the tables/views in the diagram.
Show table comments Check this box to show the table comments in the diagram.
Show view relationships Check this box to show the relationship line of the view.
Size The width and height of the object.
Visible Check this box to show the foreign key or relation lines.
Estos modelos permiten crear tablas, campos, vistas, foreign keys y otras propiedades fisicas del database schema
Cuando se cea un nuevo modelo fisico en el Explorer Pane (Superior Izquierda), existen dos opciones de visualizacion :
- Grid View : en donde se ven los objetos necesarios para construir el modelo
- Form View : en donde se ve la estructura de tablas y vistas por default
En el Form View, el menu de click derecho tiene las siguientes opciones :
Option Description
New Database / New Schema Create a database/schema.
Delete Database / Delete Schema Delete the selected database/schema including its objects from the model. The default database/schema cannot be deleted.
Rename Change the name of the database/schema.
Set As Default Database / Set As Default Schema Set the selected database/schema as the default database/schema.
Cuando se acaba el modelo se puede hacer la exportacion a un archivo de script de sql
Export SQL
After finishing your model, you can save table structures and relations from the model into a script file. The Export SQL feature generates a SQL file for the script. To start the Export SQL feature, choose File -> Export SQL from the menu bar.
---------------------------------------------------------------------------------------------------------------------------------------
General Properties
Export to File
Set the output file name and location.
Select objects to export
Choose objects in the model you wish to export.
---------------------------------------------------------------------------------------------------------------------------------------
Advanced Properties
Note: The following options depend on the diagram database type you are chosen and sort in ascending order.
Drop with CASCADE
Include drop object SQL statements with CASCADE option in the SQL file with this option in on.
Include auto increment
Include table auto increment in the SQL file with this option is on.
Include character set
Include table and field character set in the SQL file with this option is on.
Include checks
Include checks in the SQL file with this option is on.
Include collation
Include table collation in the SQL file with this option is on.
Include Drop SQL
Include drop object SQL statements in the SQL file with this option in on.
Include excludes
Include excludes in the SQL file with this option is on.
Include foreign keys
Include foreign keys in the SQL file with this option is on.
Include indexes
Include indexes in the SQL file with this option is on.
Include primary keys
Include primary keys in the SQL file with this option is on.
Include rules
Include rules in the SQL file with this option is on.
Include schema name
Include the schema name in the SQL file with this option is on. Otherwise, only object names are included in SQL statements.
Include triggers
Include triggers in the SQL file with this option is on.
Include uniques
Include uniques in the SQL file with this option is on.
Server Version
Select the server version for the SQL file.
El modelo en cualquier momento se puede sincronizar con una base de datos existente con el fin de compararlos y revisar la diferencia en sus estructuras
Synchronize to Database
The Synchronize to Database feature allows you to compare a model with an existing database or schema, states the differences between their structures, and offers synchronizing the structures in model to the target connection.
Navicat provides a step-by-step wizard for you to complete the task:
- Choose File -> Synchronize to Database.
- Select the source database, schema, and select the target connection, database, schema.
- Click Options and select the compare / advanced options.
- Click Compare to show the differences between source and target objects.
- Select the objects you want to synchronize.
- Click Deploy to generate a set of scripts.
- Click Execute.
-------------------------------------------------------------------------------------------------------------------------------------
Choose Connections
The first step is to define connections, databases and/or schemas for the source model and the target connection.
-------------------------------------------------------------------------------------------------------------------------------------
Choose Comparing Options
Then, click the Options button to select the compare / advanced options for the synchronization process.
Note: The following options depend on the diagram database type you are chosen and sort in ascending order.
Compare auto increment value
Check this option if you want to compare the auto increment values of tables.
Compare character set
Check this option if you want to compare the character sets of tables.
Compare checks
Check this option if you want to compare checks.
Compare collation
Check this option if you want to compare the collations of tables.
Compare definers
Check this option if you want to compare the definers of views.
Compare excludes
Check this option if you want to compare excludes.
Compare foreign keys
Check this option if you want to compare table foreign keys.
Compare identity last value
Check this option if you want to compare the identity last values of tables.
Compare indexes
Check this option if you want to compare indexes.
Compare owners
Check this option if you want to compare the owners of the objects.
Compare partitions
Check this option if you want to compare table partitions.
Compare primary keys
Check this option if you want to compare table primary keys.
Compare rules
Check this option if you want to compare rules.
Compare storage
Check this option if you want to compare table storages.
Compare table options
Check this option if you want to compare other table options.
Compare tables
Check this option if you want to compare tables.
Compare triggers
Check this option if you want to compare triggers.
Compare uniques
Check this option if you want to compare uniques.
Compare views
Check this option if you want to compare views.
Drop with CASCADE
Check this option if you want to drop the dependent database objects with the CASCADE option.
Identifier Case Sensitivity
Ignore or consider the case of identifiers when mapping, or use the server default setting.
Cuando se navega por encima de las relaciones de las tablas se observa el siguiente codigo de colores :
TABLA PADRE : GREEN - REFERENCED
TABLA HIJA : BLUE - REFERENCING
Asi mismo los campos referenced y referencing se ven marcados en las tablas
Cuando hago click derecho sobre la linea de relacion tengo las siguientes opciones :
Option Description
Design Relation Edit the foreign key in a table designer. The options in the designer depend on the diagram database type you are chosen.
Cardinality on table_name1 Set the cardinality on table_name1: None, One and Only One, Many, One or Many, Zero or One, Zero or Many.
Cardinality on table_name2 Set the cardinality on table_name2: None, One and Only One, Many, One or Many, Zero or One, Zero or Many.
Add Vertex Add a vertex on a foreign key connector.
Delete Vertex Delete a vertex on a foreign key connector.
Delete All Vertices Delete all vertices on a foreign key connector.
Paste Paste the content from the clipboard into the diagram.
Select All Relations Select all foreign keys in the diagram.
Delete Delete a foreign key from both diagram and model.
Color Change the color of the foreign key.
Modelos Logicos :
Esta opcion permite crear modelos logicos que incluyan entidades, atributos y relaciones
Las opciones y la mecanica es la misma que para los modelos Fisicos, obciamente con menos opciones
----------------------------------------------------------------------------------------------------------------------------------------
Modelos Conceptuales :
Esta opcion me permite crear modelos conceptuales que incluyan entidades y relaciones
Las opciones y la mecanica es la misma que para los modelos Fisicos, obviamente con menos opciones
Data Transfer :
Esta opcion me permite transferir objetos de una base de datos a otra, ambas bases de datos pueden estar en el mismo servidor o en servidores diferentes.
Para ello se usa TOOLS : Data Transfer y se usa el respectivo Wizard
---------------------------------------------------------------------------------------------------------------------------------------
Data Synchronization :
Tambien existe la opcion de Sincronizacion de datos que permite garantizar que dos bases de datos esten perfectamente sincronizadas, es decir que siempre contengan la misma informacion. La sincronizacion se puede hacer entre bases de datos del mismo servidor, o en servidores diferentes, tambien es posible hacer una sincronizacion entre MySql y MariaDB
Para ello se usa TOOLS : Data Synchronization y se usa el respectivo Wizard
---------------------------------------------------------------------------------------------------------------------------------------
Structure Synchronization :
Esta funcionalidad permite comparar la estructura de las tablas de dos bases de datos, revisar sus diferencias y sincronizarlas
---------------------------------------------------------------------------------------------------------------------------------------
Dump & Execute SQL / Script File :
Puedo vaciar el contenido de la base de datos a un archivo de script de sql :
- Selecciono la Base de Datos
- Click Derecho y escojo opcion Dump SQL File
- Structure + Data
- Structure Only
sudo snap install mysql-workbench-community
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment