Entity Relationship Modeler

 

SQL4X Manager J Enterprise Edition comes with a built in Entity Relationship Modeler to graphically create database designs and reverse engineer existing databases. The Entity Relationship Modeler is especially useful to visualize tables and relations with complex databases.

Create a new entity relationship model

 

Entity Relationship Modeler

Select E/R Modeler from the Tools menu to open the Entity Relationship Modeler. After launching the ER Modeler you will see a white page to design your model.

You can now either reverse engineer an existing database (see Database reverse engineering) or click the "Add Entity" button in the toolbar to add a new table.

     
   

Modify table definitions

Select the table and make sure the Inspector window is visible (if not click "Info" in the toolbar to display the Inspector window). The Inspector window displays the entity name (table name) and attributes (fields). To add a new field to the table click the + button in the Inspector's entity view and rename the new attribute (field).

If you want SQL4X Manager J to create a script to actually build a database with your graphical model, you have to enter the complete field definition (data type and necessary length/scale information).

     
   

Define relations

Relations can be defined graphically or manually.

To define a relation graphically press and hold the option (alt) key, click the field within the referencing table and drag the mouse to the destination field that will be referenced. (To create a 1:n relation you start with the 1 and drag to the n of the relation.) You will see the start and end field enclosed in a black box during the selection. To create the relation release the mouse first and the release the option (alt) key.

The references clause will be added to the table where you started the drag. To manually adjust the reference settings select the starting table and choose the relationship tab with the Inspector.

The Inspector's relationship tab additionally allows you to manually define relations by clicking the + button and entering the relationship options.

     
   

Coloring tables and relations

To change the color of your tables in the ER Model select the table and choose Table -> Set Color... from the context menu (ctrl-click the table to show the context menu) or use the color chooser from the toolbar.

If Auto-Color Relationships is turned on (this is the default) all relations from the colored table to other tables will be drawn with the table color. To draw relations with the default color (black) you have to turn Auto-Color Relationships off (either with the View -> Auto-Color Relationships from the context menu or with the Inspector).

     
   

Show/Hide data types

Entity Relationship diagram usually don't display data types for the attributes. If you need a more standard conforming layout you can turn the data type display off with the Inspector or through the context menu (View -> Show Datatypes).

     
   

Shadows and 3D headers

Table shadows and 3D headers for the ER model can be turned on/off through the Inspector or the context menu (View submenu).

     
   

Changing the canvas size

If you need more space for your ER diagram you can change the canvas size with the Inspector (Canvas Properties). Enter the new height/width and press return. The diagram size changes immediately.

If you make your diagram smaller be sure that all tables are positioned within the new diagram size before changing the size. Entities (tables) that will be outside the diagram after the resize will not be moved automatically.

     

 

Create SQL from an Entity Relationship Model

Click "Generate SQL" in the toolbar to save a SQL script that will create the ER Model. The generated SQL script is ANSI SQL92 compliant.

 

Save an Entity Relationship Model as Image

Click "Export as Image " in the toolbar to save the displayed ER Model as TIFF image.

 

Limitations

The Entity Relationship Modeler still has some limitations. Right now you cannot move relation lines individually or color them differently than the originating table. We are already working on enhancements to make this possible with the next release. If you have additional suggestions on how to improve the ER Modeler, please contact us at support@dbsuite.de.

 

Entity Relationship Model / Diagram Theory

The entity relationship model is a graphical representation of database tables and the relations between the tables. The SQL4X Manager J Entity Relationship Modeler is based upon the theoretical model and enhances it with many practical features to be used with modern database servers. Features available in the theoretical model that cannot be directly converted into database objects or relations (like n:m relations) are not available with the Entity Relationship Modeler.