AI ERD generator: from a description to tables, a diagram and SQL

Tell AI2SQL what your app does. It designs the tables and relationships, draws the entity relationship diagram and writes the CREATE TABLE statements, and you can keep changing it in plain English.

Short answer: open design mode in the AI2SQL builder, describe the app ("a library system where members borrow books and pay late fees"), and you get the tables, primary and foreign keys, an ER diagram, and CREATE TABLE SQL for PostgreSQL, MySQL, SQL Server or Oracle. You can then ask for changes and query the design in plain English.

How it works

  1. Describe the app. Open design mode in the AI2SQL builder and describe what the database is for, for example: a course registration system for a university with students, courses, sections, instructors and enrollments.
  2. Get the tables and CREATE TABLE SQL. AI2SQL designs the tables, columns, primary keys and foreign keys and writes the CREATE TABLE statements for your database (PostgreSQL, MySQL, SQL Server or Oracle).
  3. See the ER diagram. The builder draws an entity relationship diagram from the CREATE TABLE statements, with one-to-many and many-to-many relationships shown through their foreign keys.
  4. Change it and query it. Ask for changes in plain English (add a waitlist, split a table) and ask questions against the design; AI2SQL writes the SQL against the tables you designed.

Example: a class project

A typical database course assignment: "Design a course registration system. Students enroll in sections of courses; each section has one instructor, a term and a room; enrollment stores the grade." A first design looks like this (PostgreSQL):

CREATE TABLE students (
  student_id   SERIAL PRIMARY KEY,
  full_name    TEXT NOT NULL,
  email        TEXT UNIQUE NOT NULL
);
CREATE TABLE instructors (
  instructor_id SERIAL PRIMARY KEY,
  full_name     TEXT NOT NULL
);
CREATE TABLE courses (
  course_id  SERIAL PRIMARY KEY,
  code       TEXT UNIQUE NOT NULL,   -- e.g. CSE 412
  title      TEXT NOT NULL,
  credits    INT NOT NULL
);
CREATE TABLE sections (
  section_id    SERIAL PRIMARY KEY,
  course_id     INT NOT NULL REFERENCES courses(course_id),
  instructor_id INT NOT NULL REFERENCES instructors(instructor_id),
  term          TEXT NOT NULL,
  room          TEXT
);
CREATE TABLE enrollments (
  student_id INT REFERENCES students(student_id),
  section_id INT REFERENCES sections(section_id),
  grade      TEXT,
  PRIMARY KEY (student_id, section_id)
);

And the relationships the diagram shows:

From there, ask for what the assignment adds ("add prerequisites between courses", "add a waitlist with positions") or ask questions against the design ("list students taking more than 15 credits this term") and AI2SQL writes the SQL against your tables.

Check the design before you hand it in

For the full process and more project ideas, see database design for students.

Already have a schema?

Paste your CREATE TABLE statements into the builder instead. It draws the diagram, lists the tables and lets you ask questions against them without connecting a database. When you are ready to query real data, connect PostgreSQL, MySQL or SQL Server read-only, or let Claude or ChatGPT query it through AI2SQL.

Frequently asked

What is an AI ERD generator? +

A tool that turns a plain-English description of an app into a database design: tables, columns, keys and relationships, drawn as an entity relationship diagram, plus the CREATE TABLE SQL to build it.

Can I use AI2SQL for a database class project? +

Yes. Describe the system your assignment asks for, get a first design with an ER diagram and CREATE TABLE SQL, then check it against your course rules (normal forms, naming, cardinality) and refine it by asking for changes. Use it to learn and check your work; your instructor's requirements come first.

Which databases does the generated SQL work on? +

Design mode writes CREATE TABLE statements for PostgreSQL, MySQL, SQL Server and Oracle, and the diagram is drawn from those statements.

Can I turn an existing schema into an ER diagram? +

Yes. Paste your CREATE TABLE statements (or a schema dump) into the builder and it draws the diagram and lists the tables, so you can ask questions against them.

Is it free? +

You can sign up free and try design mode; the free plan includes a few requests a day. Pro and Team raise the limits and start with a 7-day trial.

Design your database in one sentence

Describe the app, get the ER diagram and the CREATE TABLE SQL, then ask questions against it.

Try design mode free →

Already have an account? Open design mode directly in the builder.

Related guides