Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to insert a new row 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 'select' instead of 'insert' to add data.
Using 'update' when trying to add new rows.
✗ Incorrect
The insert method adds new rows to a table in Supabase.
2fill in blank
mediumComplete the code to select all rows from the 'products' table.
Supabase
const { data, error } = await supabase.from('products').[1]('*'); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' when trying to read data.
Using 'delete' instead of 'select'.
✗ Incorrect
The select method retrieves rows from a table. Using '*' selects all columns.
3fill in blank
hardFix the error in the code to update the 'age' of a user with id 5.
Supabase
const { data, error } = await supabase.from('users').update({ age: 31 }).[1]('id', 5); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'where' which is not a Supabase-js method.
Using 'filter' which is not valid here.
✗ Incorrect
The eq method filters rows where a column equals a value. Here, it selects the user with id 5.
4fill in blank
hardFill both blanks to delete a product with id 10 from the 'products' table.
Supabase
const { data, error } = await supabase.from('products').[1]().[2]('id', 10); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'select' instead of 'delete' to remove rows.
Using 'update' instead of 'delete'.
✗ Incorrect
The delete method removes rows. The eq method filters rows where 'id' equals 10.
5fill in blank
hardFill all three blanks to select users older than 25 from the 'users' table.
Supabase
const { data, error } = await supabase.from('users').[1]('*').[2]('age', '[3]', 25); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lt' instead of 'gt' for age comparison.
Using 'eq' instead of 'gt' for greater than.
✗ Incorrect
select('*') gets all columns. filter('age', 'gt', 25) selects rows where age is greater than 25.