A layout is a database diagram with associated data and query tools. Think of it like a board on which you can make your own representation of the database schema. Inside the layout, you can edit tables and foreign keys by just double-clicking on them. Add tables, foreign keys, groups, callouts, and access data tools like Relational Data Editor or SQL Editor. You can create as many layouts as you need, each focused on a specific part of the schema. A table can be present in multiple layouts.
Inside a layout, everything is represented graphically. This will help you gain a better understanding of the database and browse the data easily.
Foreign keys can also have different visual representations based on their cardinality and ordinality. These are consequences of the nature of columns and indexes.
Based on the referencing column, there are 4 states in which a foreign key can be. We will try to understand them better by looking at some examples:
In the child table, the referencing column is not mandatory, nor unique. In this case, the parent table (1) can refer to zero or many entries in the child table (2).
In the child table, the referencing column is mandatory, but not unique. In this case, the column from the parent table can refer to one (mandatory) or many.
In the child table, the referencing column is mandatory and unique. In this case, the column from the parent table can refer only to one entry from the child table.
In the child table, the referencing column is unique, but not mandatory. In this case, the column from the parent table can refer to one or zero entries from the child table.
There are databases that contains no foreign keys. In these situations, you may create virtual foreign keys. Virtual foreign keys will be created only in DbSchema and will be saved to the model file.
Using DbSchema you can design the schema while connected to a database (online) or without database
connection (offline).
In the online mode, all table and column changes will be applied in the database. The executed statements are visible on the left, in the SQL History pane.
In the offline mode, changes will be applied only to the DbSchema model which will be saved to file. You need to connect to the database and choose one of the Schema options (Refresh/Compare with the database).
1. Add tables from the tree panel by drag & drop.
2. Add tables using the foreign key icon.
The foreign key line is routed automatically.
DbSchema is optimized for managing large diagrams, where this feature is likely to create problems.
You can choose between two modes of routing the foreign key lines: from table to table or from column to column.
In the second case, the line will point to the involved columns. Two foreign keys may merge into one line if they are pointing to the same column.
Add callouts by right-clicking on an empty part of the layout. Choose the Create a Callout option.
Browse data from tables directly in the layout. Hold SHIFT + CTRL and click on the table header to see its contents.
Layouts can be dropped by right-clicking the layout in the structure tree.
When closing a layout, DbSchema will ask if you wish to preserve the layout in the design model ( close the layout but keep a copy in the design model, so it can be reopen at any time ), or close and drop from the design model as well.
The same is done with the other data tools: SQL Editor, Query Builder and Relational Data Explorer.