Visual mysql database design in mysql workbench pdf




















Provide the connection details. The created connection will be displayed, as shown in the screenshot below. After adding a new diagram, a new window will be opened, as in the screenshot below.

Scenario In this tutorial, we will model and create a database that will be used to keep book details. Publisher: id, name. An author can have multiple publications. A book can also have multiple authors. This type of relationship requires an extra table called a bridge table. MySQL Workbench automatically creates a bridge table when we add a many-to-many relationship. The relationship between the book and the publisher is one-to-many. A book can only have one publisher. A publisher can publish multiple books.

The vertical toolbar panel The vertical toolbar has different tools used in creating EER diagrams. Add tables We are going to add three tables to the EER model. To add a table, follow these steps: Select the table tool on the vertical tools panel, then click anywhere on the EER diagram canvas.

This creates a table with no columns. Double click the table created to open the table properties window. On the table properties window, change the table name. Add columns to the table. To add new columns, click on the last blank column.

Edit the column name and select the appropriate data type for each column. Please do not add the columns described as foreign keys. MySQL Workbench has an easier way of adding them by creating relationships, and the foreign keys are added automatically.

Select all the column properties such as primary key, not null, unique, and autoincrement. Repeat the process for all the tables. Your EER diagram should look as shown below. Add relationships We will add two different relationships to the EER diagram. One-to-many relationship There is a one-to-many relationship between the book and the publisher.

Many-to-many relationship There is a many-to-many relationship between the book and the author. After creating the relationships, the EER diagram will be as shown in the screenshot below. Forward engineering with MySQL Workbench The visual database model created can be transformed into a physical database. Click NEXT. Step 3 The wizard gives us SQL export options. For this exercise, use the default selected options. Step 4 Select the objects you would like to include in the EER diagram.

Make sure the option to import 4 table objects is selected, then click NEXT. Step 5 In this step, we are provided with the generated SQL script. Step 6 This is the final step. Reverse engineering with MySQL Workbench Reverse engineering enables us to have a better view of an existing database.

Step 3 Review the information displayed and make sure that the connection was successful, then click NEXT. Step 4 Select the schema you would like to reverse engineer. Step 5 The results of the tasks carried out are displayed in the wizard below. Step 6 We are prompted to select the objects to reverse engineer. Database change management is a difficult and complex process, which involves maintaining different versions of database schemas and manually modifying existing databases.

A DBA can compare two live databases or a model and a live database and visually see the differences, and also perform synchronization between a model and a live database or vice versa.

Documenting database designs can be a time-consuming process. Change Management Database change management is a difficult and complex process, which involves maintaining different versions of database schemas and manually modifying existing databases.

On next screen you have an option to select object types and filter specific objects. Let's ignore it and import all objects. Wait for reverse engineering to take place and when done continue with Next. Final screen shows you a summary of the import. Close with Finish. When the process ends with success you get a new model more about models here with default diagram with all tables and views.

What you probably want to do right after you created a default diagram is to remove unnecessary tables and views and arrange tables to make it easier to grasp. To remove table from diagram select it, right click and choose Remove Figure option.

Be careful not to choose Delete option as it will remove table not only form diagram but also your model catalog. Without a warning!



0コメント

  • 1000 / 1000