Where to Find DBML Documentation and Examples
Updated
DBML's official home is dbml.dbdiagram.io, the documentation site for the Database Markup Language used by dbdiagram.io. Use it when you need the syntax reference, a quick example schema, or a pointer to the visual editor; the site itself is a documentation and resource hub, not a hosted database tool.
What the Site Is For
DBML (Database Markup Language) is a text format for describing database structures — tables, columns, indexes, and relationships — in a readable, version-controllable way. The dbml.dbdiagram.io site exists to explain that format and connect it to the tooling around it.
Practically, the site serves three purposes:
- Syntax reference — how to write table definitions, column types, settings, and relationship statements.
- Examples — sample schemas you can read and adapt rather than starting from a blank file.
- Tool entry points — links toward dbdiagram.io, where a DBML file can be rendered as an entity-relationship diagram.
If your question is "what is DBML," the site's introductory material answers it. If your question is "how do I write a table definition," the syntax pages are the place to look.
Finding the Syntax Reference
Start from the site's navigation rather than guessing URLs. Documentation sites of this kind typically organize content into an introduction, a syntax or language section, and a database-specific notes section.
When you land on the syntax pages, expect coverage of the core building blocks:
| Element | What it describes |
|---|---|
| Table block | The table name and its enclosed column definitions |
| Column definition | Column name, data type, and inline settings |
| Settings | Constraints such as primary key, not null, unique, default, and notes |
| Relationships | References between columns, expressed as ref lines |
| Indexes | Composite or named indexes declared inside a table |
A minimal table definition follows the pattern of a Table keyword, a name, and a brace-delimited body of columns — for example, a users table with an integer primary key and a variable-length name column. The exact syntax for each setting is what the reference pages document, so treat any example you copy as a starting point and confirm details against the current reference.
Examples and the Playground
Example schemas are the fastest way to learn DBML because they show settings and relationships in context. Look for a samples or examples section on the site, and for links to the dbdiagram.io editor, which functions as a live playground: you paste or type DBML on one side and see the diagram update.
A useful exercise when you find an example:
- Copy the example into the editor.
- Change a column type or add a setting such as
not null. - Confirm the diagram reflects the change.
- Add a
refbetween two tables and check that the relationship line appears.
This verifies your understanding of the syntax against actual rendering behavior rather than against the text alone.
Common Sticking Points
- Confusing the documentation site with the editor. dbml.dbdiagram.io explains the language; diagram rendering happens in dbdiagram.io. If you are looking for a place to type DBML and see output, follow the tool links rather than staying on the docs pages.
- Assuming database-specific types are universal. DBML supports notes on how types map to particular databases; check those sections before assuming a type behaves identically across engines.
- Copying examples without checking settings. Examples often omit constraints for brevity. Add primary keys, nullability, and relationships deliberately.
- Expecting export or pricing details on the docs site. The documentation covers the language; account, export, and plan details belong to the dbdiagram.io product pages.
A Reasonable Path
If you are new: read the introduction, then the table and column syntax, then relationships. Build one small schema in the editor and iterate. If you already know the basics: go straight to the settings and relationship reference, and use the examples to confirm edge cases such as composite indexes or many-to-many patterns expressed through a join table.