How to view relationship in mysql workbench

  1. First make sure you have a Database and Tables created on the MySQL server.

Example :-

Database - bank.

Tables - account, branch, customer, loan, trandetails.

2. Click on Database -> Reverse Engineer.

3. Select your stored connection [for connecting to your MySQL Server in which database is present] from the dropdown. Then click Next.

4. After the execution gets completed successfully [connection to DBMS], click Next.

5. Select your Database from the MySQL Server for which you want to create the ER Diagram [in our case the database name is “bank”], then click Next.

6. After the retrieval gets completed successfully for the selected Database, click Next.

7. Select the Tables of the Database which you want to be visible on the ER Diagram [In this case I am importing all the tables of the DB], then click Execute>.

8. After the Reverse Engineering Process gets completed successfully, click Next.

9. Click Finish.

Now you can see the ER Diagram of the Database.

How can I see relationships in MySQL?

To see foreign key relationships of a table: SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA. KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'db_name' AND REFERENCED_TABLE_NAME = 'table_name';

How do I find the ER diagram in MySQL Workbench?

4 Answers.
Go to "Database" Menu option..
Select the "Reverse Engineer" option..
A wizard will be open and it will generate the ER Diagram for you..

How do you create a relationship in a workbench?

To create a relationship in MySQL Workbench: Create a database model [either create a new model or reverse engineer an existing database] Viewing the database model, double click on the first table of the relationship. The bottom pane will open with the table details.

Bài mới nhất

Chủ Đề