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_id
The users and orders tables become class boxes connected by the declared foreign key. No login method, ORM lifecycle, or application behavior is invented from the schema.

How to use this tool

  1. Paste MySQL CREATE TABLE statements, including declared foreign keys.
  2. Convert and review SQL warnings for skipped statements or changed identifiers.
  3. Check the attributes and association direction. Use the ER diagram converter if database cardinality is the main question.

What to check

DetailGuidance
Table to classEach table becomes a class with column types and names as attributes.
Foreign keysDeclared keys become associations. Name-based relationship inference is disabled in this conversion.
Not generatedMethods, 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.