Skip to content

Your first project

This is the shortest possible tour: create a table, put a row in it, and look at the result. Everything here is in simple mode, which is how the playground starts.

The whole tour: create a table, add columns, insert a row, show the data.

When you launch rdbms-playground with no arguments, it opens a fresh temporary project for you. Type commands into the input field at the bottom and press Enter to run them. As you type, the field completes commands with Tab and flags mistakes before you run — see The assistive editor.

The quickest way to make a table is with pk on its own, which gives you a ready-made primary key column called id:

create table authors with pk

You never fill id in yourself — the database assigns it as you add rows. (You can also name and type the key yourself; see the Tables reference.)

In simple mode you create a table with its key, then add the other columns one at a time:

add column to authors: name (text)
add column to authors: birth_year (int)

insert adds a row. List the columns you are supplying — id fills itself in automatically:

insert into authors (name, birth_year) values ('Ada Lovelace', 1815)

The playground shows the row it just inserted, including the generated id.

show data authors

That is the whole loop: create → add columns → insert → show. From here: