SQL Server database design

Quick start guide for SQL Server database design.

1. New project

To create a new project, click New on the main toolbar and select the SQL Server project type.

2. Add tables

Basic database objects can be added to your project/diagram by clicking the appropriate icon on the main toolbar.

Adding new object to ERD for SQL Server

Then click the diagram area. A new graphical object will appear on the diagram.

Edit properties in Right Side panel:

SQL Server table properties in a side panel

Alternatively, you can double click the graphics or right-click the item and choose Edit to open a larger modal form.

Modal form showing table properties

Table properties

Basic type settings can be specified in the section Details.

Columns

In section Columns, you can add new table columns. Specify new column name, datatype and click Add.

  • PK indicates primary key.
  • NN represents Not Null column.

Detailed column specifics can be defined in a collapsible/expandable area.

Editing column properties

Note: Sample data will appear in the diagram if the Sample data mode is activated.

3. Views, procedures, functions, sequences, triggers, user defined types and other objects

All other supported objects can be added to the diagram either by clicking the Other icon on the main toolbar, selecting the object type and then clicking the diagram area or, by right-clicking the diagram area and selecting the desired object type.

Adding a new database view to a diagram

After adding the object to the diagram you can double click it and edit properties or use the right side panel for making modifications.

SQL Server sequence properties

4. Relationships

Relationships can be created between parent and child tables (for other visual references you can use Lines and connect two graphical objects).

To add a new relationship to the diagram, click the Relationship icon, then click the parent table and then the child table. If the primary key is defined in the parent table, a new column will be added to the child table and marked as a foreign key.

Example: relationship drawn from table customer to table cart. Foreign key column customer_id was added to the child table automatically.

SQL Server relationship properties

Read more about one-to-many relationships and many-to-many relationships.

5. Code generation

To generate an SQL script, click the SQL Script icon on the main toolbar.

ER diagram for SQL Server - SQL script generated by Luna Modeler

How to execute the script? Use another tool, for example Microsoft SQL Server Management Studio.

6. Other features and visual elements

Notes, lines and other information that can be displayed in a diagram will help you keep the structure well documented. You can also display descriptions instead of columns in the ER diagrams.

ER Diagram for SQL Server. Displayed descriptions.

7. Reverse engineering and visualization of existing database structures

You can establish a connection to your SQL Server database and load the existing structure, incl. all supported SQL Server objects.

To reverse engineer a database, create a new connection:

SQL Server connection

Your new connection will appear in page Connections where you can also filter connections by name or platform.

To load the structure click Connect and load existing database structure.

Connections for SQL Server

Enjoy!

#

Quick links

Download Buy Now!

Blog Categories
Blog by Platforms