There are many ways of creating database tables and relationships in MySQL:
- You can use data description language (DDL) statements directly at MySQL Command Prompt from the Terminal
- You can use MySQL Workbench and create tables directly
- You can create an entity-relationship diagram in MySQL Workbench, export it to create a DDL script, and then run this script to create tables and relationships
We will use the third option. If you just want to get the script to create tables and want to skip creating the ER diagram, then jump to the Script to create tables and relationships section of this chapter.
If you have not already installed MySQL and MySQL Workbench, then refer to Chapter 1, Introducing JEE and Eclipse, for instructions:
- Open MySQL Workbench. Select the
File
|New Model
menu. A blank model will be created with the option to create ER diagrams:
Figure 4.1: Creating a new MySQL Workbench model
Figure 4...