RSRobince Studio

Database Schema Designer

Plan a database in your browser. Add tables and columns, mark primary keys and unique fields, link foreign keys to draw the relationships, and copy ready-made CREATE TABLE SQL for PostgreSQL, MySQL or SQLite. Download the diagram as a PNG or SVG. Nothing is uploaded.

Runs in your browser. Your files are never uploaded.

Loading Database Schema Designer…

How to use Database Schema Designer

  1. Press Add table, click it and type a table name, then add columns with a name and a type.
  2. Tick PK for the primary key, and use Not null, Unique and Auto where they apply.
  3. To link tables, set a column Link to another table's column. A relationship line with a crow's foot on the many side is drawn for you.
  4. Choose PostgreSQL, MySQL or SQLite and press Copy SQL, or download the diagram as a PNG or SVG.

Designing a schema step by step

Start with the nouns in your project: users, products, orders, posts. Each becomes a table. Give every table an id column as its primary key. Then list the facts you need to store about each one and add them as columns with sensible types.

Next, find the relationships. If one thing belongs to another, put the other table's id in it as a foreign key. A post belongs to a user, so posts has a user_id. Avoid storing the same fact in two places, because it gets out of date.

Choosing column types

Use INT or BIGINT for ids and counts, VARCHAR for short text such as names and emails, and TEXT for long text. Use BOOLEAN for yes or no values, DATE for dates, TIMESTAMP for date and time, and DECIMAL for money so there are no rounding surprises. UUID suits ids that must be unique across systems, and JSON suits flexible data that you do not need to search by column.

The SQL types are translated for each database. For example, SQLite stores values using a few simple types, so INT becomes INTEGER and VARCHAR becomes TEXT.

Tips

  • Name tables in the plural and columns in snake case, such as order_items and created_at.
  • Add Not null to columns that must always have a value.
  • Add Unique to columns such as email where two rows must never match.
  • Index foreign key columns in your real database if you filter or join on them a lot.
  • Use a join table for many-to-many relationships.

Limits

This tool covers basic tables, keys and relationships. It does not generate indexes, check constraints, default values, views or triggers, and it does not read or import existing databases. Always read the generated SQL and test it on a copy before running it on real data. Your schema is stored in this browser only, so download a copy of anything important.

Why use this database schema designer tool

  • Visual tables and relationships. Drag tables around the canvas. Foreign keys appear as lines with a bar on the one side and a crow's foot on the many side.
  • SQL for three databases. Generate CREATE TABLE statements for PostgreSQL, MySQL or SQLite, with keys, NOT NULL, UNIQUE, auto-increment and foreign keys.
  • Tables in the right order. Tables are output so referenced tables are created first, which avoids foreign key errors when you run the script.
  • Private, with files you can keep. Your schema is drawn and saved in your browser. Download PNG, SVG or a file you can open again later. No account needed.

Frequently asked questions

How do I design a database schema online?

List the things you need to store, such as users and orders, and add one table for each. Give each table a primary key, add the columns it needs, then link related tables with foreign keys. This tool draws the relationship diagram and writes the SQL for you.

What is an ER diagram?

An entity-relationship diagram shows the tables in a database and how they relate. Each box is a table with its columns, and the lines between boxes show relationships such as one user having many posts.

What is the difference between a primary key and a foreign key?

A primary key uniquely identifies each row in its own table. A foreign key is a column that stores the primary key of a row in another table, which creates the relationship between them. In this tool, set a column's Link to the other table's key to make a foreign key.

How do I show a one-to-many relationship?

Put the foreign key on the many side. For example, a posts table has a user_id column linked to users.id, so one user can have many posts. The line is drawn with a crow's foot at the posts end.

How do I show a many-to-many relationship?

Add a join table that has two foreign keys, one to each table, for example student_courses with student_id and course_id. Make both columns the primary key together if each pair should appear once.

Can I import SQL or connect to my database?

No. This tool designs a schema from scratch and generates SQL. It does not read an existing database or import SQL, and it never connects to a server.

More free tools