Link a book to its author — no orphans

You're building a simplified database for a bookstore. Every book must have an author — no orphans allowed. Build two tables: authors with id (primary key) and name, and books with id (primary key), title (up to 200 chars), and a required author_id referencing authors(id). The «required column plus parent reference» combo guarantees a book can't land in the database without an author.

Just CREATE/ALTER/DROP — no trailing SELECT needed.

PostgreSQLv16

Your query result will appear here

No starting schema

This task starts with no tables — you'll create them via CREATE TABLE.

Focus radio
Paused · SomaFM · Fluid