Syntax reference
# comment Owner ← table: no indent Id ← int, primary key Name ← no type = vc Email vc unique Dog OwnerId -> Owner ← FK to its PK OwnerMail -> Owner.Email DogToShow ← no Id = no PK… DogId -> Dog ShowDate date Place int pk (DogId, ShowDate) ← …unless pk unique (ShowDate, Place)
pkPrimary key. An explicit pk wins over Id.
nullColumn may be NULL (default is NOT NULL).
uniqueUNIQUE constraint — this is how 1‑1 is made.
auto_incrementThe database numbers the rows itself. An integer Id gets this on its own; write it for another integer primary key. a_i for short.
pk (A, B)One primary key over several columns: only the combination must be unique, each column alone may repeat.
unique (A, B)The combination is unique. Here: one dog per place at each show.
indexAn index on the column, so searches and JOINs on it are fast. index (A, B) for one over several columns.
-> TableForeign key to that table's primary key. The column inherits its type.
-> T.ColForeign key to a specific (PK or unique) column.
[delete cascade]Last on a -> line: deleting the row it points to deletes this row too. [delete set null] empties the column instead (it must be null); [update cascade] follows a changed key.
[default 0]The value when an INSERT leaves the column out: a number, 'text', true, false or now. Several go together: [delete cascade, default 1].
OwnerIdWith Implicit on (top bar), a column named table + Id gets an arrow to that table's PK, even without ->. Diagram only: not a foreign key in the SQL.
vcvarchar(128). Other types as-is: int, text, date, datetime, decimal(8,2)…
# e.g. A, BAfter a column: the values its sample data takes (Sample data, and the SQL export with it). # t.ex. works too.
Drag headerMove a table
⇧/⌘ + click a tableAdd it to the selection
⇧ + drag canvasSelect tables in a box
Drag a selected tableMove all selected
↵ / ⌫ / ⌘DEdit / delete / duplicate the selected tables
Right-click a tableEdit it, add a column, duplicate or delete it
Right-click the canvasNew table, select all, layout, zoom, copy image
⌘F / ⌘KFind a table or column (in the editor ⌘F finds text)
⌘ASelect all tables
⇧1 / ⇧0Fit to screen / zoom to 100%
Drag canvasPan
⌘ + scrollZoom
Click a rowJump to its line
Double-click a table or columnEdit it in a dialog
Hover a tableHighlight its arrows
SQL tabEdit as MariaDB, MySQL, SQLite, PostgreSQL, SQL Server or Oracle (menu beside SQL); changes convert back to Simple
No tables yet
Type a table name in the editor, or use New table.
Or open an example:
·
Sample data in
Drag a table by its header to move it. Shift-click tables to select several, or shift-drag the canvas to select an area, then drag any of them to move them together.
Diagrams are saved only in this browser, not on your disk. Clearing browser data or using another browser or computer means they are gone. Use Export to keep a copy.