Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new table in Supabase using SQL.
Supabase
CREATE TABLE [1] (id SERIAL PRIMARY KEY, name TEXT, active BOOLEAN DEFAULT true); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved keywords as table names
Choosing unrelated names like 'storage'
✗ Incorrect
The table name should be users to store user data.
2fill in blank
mediumComplete the code to insert a new user into the users table.
Supabase
INSERT INTO users (name) VALUES ([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around strings
Using double quotes which are for identifiers
✗ Incorrect
String values in SQL must be enclosed in single quotes.
3fill in blank
hardFix the error in the SQL query to select all users.
Supabase
SELECT * FROM [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'user' instead of plural 'users'
Guessing table names incorrectly
✗ Incorrect
The correct table name is users, matching the table created earlier.
4fill in blank
hardFill both blanks to create a Supabase client and connect to the database.
Supabase
const supabase = createClient([1], [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost instead of the real URL
Using admin key on client side
✗ Incorrect
The first argument is the Supabase URL, and the second is the public anonymous key for client access.
5fill in blank
hardFill all three blanks to write a query that fetches active users from the users table.
Supabase
const { data, error } = await supabase.from([1]).select([2]).eq([3], true); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table name
Selecting specific columns instead of all
Filtering by wrong column
✗ Incorrect
This query selects all columns (*) from the 'users' table where the 'active' column is true.