0
0
Supabasecloud~10 mins

Creating tables via SQL editor in Supabase - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a table named 'users' with an 'id' column as the primary key.

Supabase
CREATE TABLE [1] (id SERIAL PRIMARY KEY);
Drag options to blanks, or click blank then click option'
Ausers
Buser_table
Cuser
Daccounts
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'user' instead of 'users'.
Using unrelated table names like 'accounts'.
2fill in blank
medium

Complete the code to add a 'username' column of type VARCHAR with a maximum length of 50 characters.

Supabase
ALTER TABLE users ADD COLUMN [1] VARCHAR(50);
Drag options to blanks, or click blank then click option'
Auser_name
Bname
Cusername
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user_name' with an underscore instead of 'username'.
Using generic names like 'name' or 'user'.
3fill in blank
hard

Fix the error in the code to create a table with an 'email' column that cannot be null.

Supabase
CREATE TABLE contacts (id SERIAL PRIMARY KEY, email VARCHAR(100) [1]);
Drag options to blanks, or click blank then click option'
AUNIQUE
BNOT NULL
CNULL
DDEFAULT
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'NULL' which allows empty values.
Using 'UNIQUE' which only enforces uniqueness but not nullability.
4fill in blank
hard

Fill both blanks to create a table 'products' with an 'id' as primary key and a 'price' column of type numeric with 2 decimal places.

Supabase
CREATE TABLE [1] (id [2] PRIMARY KEY, price NUMERIC(10, 2));
Drag options to blanks, or click blank then click option'
Aproducts
BINTEGER
CSERIAL
Dproduct
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular table name 'product'.
Using 'INTEGER' without auto-increment for primary key.
5fill in blank
hard

Fill all three blanks to create a table 'orders' with 'order_id' as primary key, 'order_date' as date type, and 'customer_id' as integer foreign key.

Supabase
CREATE TABLE [1] ([2] SERIAL PRIMARY KEY, order_date [3], customer_id INTEGER REFERENCES customers(id));
Drag options to blanks, or click blank then click option'
Aorders
Border_id
CDATE
DTIMESTAMP
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'TIMESTAMP' instead of 'DATE' for 'order_date'.
Using wrong table or column names.