- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
Visualizers
Mermaid ER Diagram Editor
Design a database as an entity relationship diagram. Edit the example, or open the tables of our SQL Online Compiler here.
- Runs in your browser
- Instant results
- Free, no sign-up
Loading the tool…
How to use the Mermaid Live Editor
- Write relationships like "CUSTOMER ||--o{ ORDER : places" after "erDiagram".
- List each table's columns in braces with their type and PK or FK.
- Download SVG or PNG, copy the Markdown block, or copy a share link.
Frequently asked questions
How do I read the symbols in a Mermaid ER diagram?
Each end of a line shows how many rows can match: || exactly one, |o zero or one, }o zero or more, }| one or more. "CUSTOMER ||--o{ ORDER" means one customer has zero or more orders.
How do I mark primary and foreign keys?
Add PK, FK or UK after the column, for example "int id PK" or "int customer_id FK". Several keys can be combined with commas.
Can I make an ER diagram from my SQL tables?
Yes. Run your CREATE TABLE statements in the SQL Online Compiler, open the Schema tab and choose "Open as Mermaid ER diagram". The tables, columns and foreign keys open here as an erDiagram.
What is the difference between -- and .. in an ER diagram?
A solid line (--) is an identifying relationship, where the child cannot exist without the parent. A dashed line (..) is non-identifying.
Syntax cheat sheet
| Code | What it does |
|---|---|
erDiagram | Start an entity relationship diagram |
USER ||--o{ ORDER : places | One user places zero or more orders |
|| |o }o }| | Exactly one, zero or one, zero or more, one or more |
-- .. | Identifying (solid) and non-identifying (dashed) relationship |
USER { int id PK } | A table with a column, its type and a key |
string email UK | A unique key column |
int user_id FK "owner" | A foreign key column with a comment |
Practice Python with coding challenges
Solve hands-on problems right in this editor: run the sample tests, submit, and get an AI code review.