Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all rows from the 'users' table in Supabase.
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 table name that does not exist in the database.
Forgetting to put the table name as a string.
✗ Incorrect
The 'from' method specifies the table to query. Here, 'users' is the correct table name.
2fill in blank
mediumComplete the code to filter users where 'age' is greater than 18.
Supabase
const { data, error } = await supabase.from('users').select('*').[1]('age', 18); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter' which does not exist in Supabase JS client.
Using 'eq' which means equals, not greater than.
✗ Incorrect
The 'gt' method is used to filter where age is greater than 18.
3fill in blank
hardFix the error in the code to insert a new user with name 'Alice' and age 30.
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' to add new data.
Using 'select' which only reads data.
✗ Incorrect
To add new data, use the 'insert' method. 'update' changes existing data, 'select' reads data, and 'delete' removes data.
4fill in blank
hardFill both blanks to update the 'age' of user with id 5 to 40.
Supabase
const { data, error } = await supabase.from('users').[1]({ age: 40 }).[2]('id', 5); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' instead of 'update' to modify data.
Using 'filter' instead of 'eq'.
✗ Incorrect
Use 'update' to change data and 'eq' to specify which rows to update by id equals 5.
5fill in blank
hardFill all three blanks to delete users older than 60.
Supabase
const { data, error } = await supabase.from('[1]').[2]().[3]('age', 60); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter' instead of 'delete' and 'gt'.
Using 'gte' or 'eq' instead of 'gt' for the operator.
✗ Incorrect
We delete from 'users' table using .delete().gt('age', 60).