Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to delete a row from the parent table.
SQL
DELETE FROM parent_table WHERE id = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around numeric id values.
Using column names instead of values.
✗ Incorrect
We use the actual id value (10) without quotes because id is numeric.
2fill in blank
mediumComplete the code to preview rows in the child table that will be deleted due to CASCADE.
SQL
SELECT * FROM child_table WHERE parent_id = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numeric values.
Using column names instead of values.
✗ Incorrect
We use the numeric value 10 to match the parent_id column.
3fill in blank
hardFix the error in the CASCADE delete preview query.
SQL
SELECT * FROM child_table WHERE parent_id = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the semicolon at the end.
Using quotes around numeric values.
✗ Incorrect
The semicolon is needed to end the SQL statement properly.
4fill in blank
hardFill both blanks to preview and then delete rows with CASCADE.
SQL
SELECT * FROM child_table WHERE parent_id = [1]; DELETE FROM parent_table WHERE id = [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numeric values.
Using column names instead of values.
✗ Incorrect
Use the numeric value 10 for both preview and delete to match the parent row.
5fill in blank
hardFill all three blanks to preview child rows, delete parent row, and confirm deletion.
SQL
SELECT * FROM child_table WHERE parent_id = [1]; DELETE FROM parent_table WHERE id = [2]; SELECT * FROM child_table WHERE parent_id = [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numeric values.
Using column names instead of values.
✗ Incorrect
Use the numeric id 10 consistently to preview, delete, and confirm child rows.