Tools / Editor
SQL to Class Diagram Converter
Convert MySQL table definitions into a Mermaid class diagram. Inspect columns and foreign-key associations without inventing ORM behavior.
What table definitions reveal about a model
Convert MySQL CREATE TABLE definitions into a class-style view of a database structure. Tables become classes and columns become attributes. This can help explain a persistence model alongside object-oriented documentation, provided you keep the distinction between a table and a software class clear.
A worked example
Input
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(80));
CREATE TABLE orders (id INT PRIMARY KEY, user_id INT, FOREIGN KEY (user_id) REFERENCES users(id));Diagram source
classDiagram
class users {
int id
varchar name
}
class orders {
int id
int user_id
}
orders --> users : user_idHow to use this tool
- Paste MySQL CREATE TABLE statements, including declared foreign keys.
- Convert and review SQL warnings for skipped statements or changed identifiers.
- Check the attributes and association direction. Use the ER diagram converter if database cardinality is the main question.
What to check
| Detail | Guidance |
|---|---|
| Table to class | Each table becomes a class with column types and names as attributes. |
| Foreign keys | Declared keys become associations. Name-based relationship inference is disabled in this conversion. |
| Not generated | Methods, ORM behavior, inheritance, and relationship cardinalities are not inferred from table definitions. |
Common questions
Is the result an ORM model?
No. It is a visual summary. An ORM can map several tables to one domain object or apply behavior that SQL does not describe. Review that mapping separately before drawing conclusions about application design.