How to create a new SQL database using a SQL database creator?
You can manually write SQL scripts in your favorite SQL editor and execute individual SQL commands directly on the connected database. However, another option is to use a data modeling tool in which you design the database structure visually, using an ER diagram. This method has a number of advantages, of course.
Key benefits of visual SQL database creator
- graphical display of entities and attributes
- visualization of the relationships between entities
- additional information added to the diagram in the form of Notes
- easier design in the initial phase of database structure creation
- easier communication between team members etc.
SQL script creation
Specialized data modeling tools usually allow you to generate the resulting SQL script from the ER diagram. This script usually needs to be run in a tool for running SQL scripts. For example PGAdmin for PostgreSQL.
In Luna Modeler, just click the SQL Script button on the toolbar.
A window with a preview of the SQL script will appear.
From version 5.0, it is possible to set the rules for generating SQL. You can choose whether quotes should always be used or only if needed. What will be the indentation of individual statements, etc. For more information see topic Forward engineering.
In what order will the objects be created?
For some SQL databases the order in which objects are created is very important. Before e.g. a session is created, the table being referenced is checked. In many other cases, it then depends on whether functions are generated before views or vice versa. And so on.
For some databases, it is possible to turn off certain types of checking (e.g., foreign key checking in MySQL), which can make it easier to run SQL scripts to create SQL databases.
To order objects in Luna Modeler, go to the Items order tab. Here, change the order of the objects using drag and drop.