Skip to content
Chapter Practice Arena

Modifying Data Problems

Targeted practice challenges specifically curated for this chapter. Inspect hints, verify outputs, and check verified solutions.

All Chapters
Filter by Language:5 Problems
Filter by SQL Chapter:
Difficulty:
Chapter:
Showing 5 challenges · 5 total · Page 1 of 1
8. Safe INSERT Practices
Starter Code
-- Practice query for Understanding INSERT, UPDATE, and DELETE Safely
Expected Output
When the email is new: A row containing the generated customer_id and aman@example.com is returned. When the email already exists: No row is returned because the insert is skipped.
12. Practice Exercises
Starter Code
-- Practice query for Understanding INSERT, UPDATE, and DELETE Safely
Expected Output
The SELECT previews one row if customer_id 1 exists. The UPDATE returns the new balance. The transaction's change is discarded by ROLLBACK. The DELETE returns the removed customer's name if customer_id 3 exists.
3. Safely Preview UPDATE Operations
Starter Code
-- Practice query for Understanding INSERT, UPDATE, and DELETE Safely
Expected Output
Formatted Result
customer_idfull_nameemail
2Ravi Kumarravi.new@example.com
1 row returned3 columns
4. Safely Preview DELETE Operations
Starter Code
-- Practice query for Understanding INSERT, UPDATE, and DELETE Safely
Expected Output
Formatted Result
customer_idfull_nameemail
3Meera Singhmeera@example.com
1 row returned3 columns
10. Controlled Batch Deletion in PostgreSQL
Starter Code
-- Practice query for Understanding INSERT, UPDATE, and DELETE Safely
Expected Output
Returns the session_id values deleted by this batch. The statement deletes no more than 100 rows selected by the CTE. It may delete fewer than 100 if fewer eligible rows exist.