Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize a Supabase client with your URL and key.
Supabase
const supabase = createClient('[1]', 'your-public-anon-key');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost or local IP instead of the Supabase project URL
Using an incorrect or incomplete URL
✗ Incorrect
You must use your Supabase project URL to connect the client properly.
2fill in blank
mediumComplete the code to fetch data from a Supabase table named 'users'.
Supabase
const { data, error } = await supabase.from('[1]').select('*'); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong table name that does not exist
Misspelling the table name
✗ Incorrect
The table name must match the one you want to query, here 'users'.
3fill in blank
hardFix the error in the code to insert a new user into the 'users' table.
Supabase
const { data, error } = await supabase.from('users').[1]({ name: 'Alice', age: 30 }); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' instead of 'insert' for adding new data
Using 'select' which only reads data
✗ Incorrect
To add new data, use the 'insert' method.
4fill in blank
hardFill the blank to filter users older than 25 and order by name ascending.
Supabase
const { data, error } = await supabase.from('users').select('*').[1]('age', 25).order('name', { ascending: true }); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lt' (less than) instead of 'gt' (greater than)
Using 'neq' (not equal) which does not filter properly
✗ Incorrect
'gt' means greater than. Here we want users with age greater than 25.
5fill in blank
hardFill both blanks to update the user's email where id equals 5.
Supabase
const { data, error } = await supabase.from('users').[1]({ email: 'new@example.com' }).[2]('id', 5); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'select' instead of 'update' to change data
Using 'neq' instead of 'eq' for filtering
✗ Incorrect
Use 'update' to change data and 'eq' to filter by id equals 5.