Creating tables via SQL editor
📖 Scenario: You are setting up a simple database for a small online bookstore using Supabase. You will create tables to store information about books and authors.
🎯 Goal: Create two tables named authors and books using the Supabase SQL editor. The authors table will store author details, and the books table will store book details including a reference to the author.
📋 What You'll Learn
Create a table called
authors with columns author_id (integer, primary key), name (text, not null), and birth_year (integer).Create a table called
books with columns book_id (integer, primary key), title (text, not null), author_id (integer, foreign key referencing authors.author_id), and published_year (integer).Use appropriate SQL syntax to define primary keys and foreign key constraints.
Ensure the tables are created successfully in the Supabase SQL editor.
💡 Why This Matters
🌍 Real World
Creating tables is the first step in building a database for any application, such as an online bookstore, to store and organize data efficiently.
💼 Career
Database creation and management skills are essential for cloud engineers, backend developers, and data professionals working with cloud databases like Supabase.
Progress0 / 4 steps