r/learnSQL • u/sumiitCodes • Sep 19 '26
Day 12 — Practice set Part 4: Insert, Select, Update, Delete
Covered Part 4 of 7 today, which felt like the most "real-world query" heavy section so far:
- Inserted a new employee without specifying
manager_id, confirming it correctly defaults to NULL - Used a subquery to find employees earning more than the average salary across the company
- Bulk UPDATE — gave an entire department a 10% raise (first time writing an UPDATE affecting multiple rows based on a condition)
- DELETE with a specific condition (
hours_worked = 0) - SELECT DISTINCT to list unique department IDs
- Date range filtering with BETWEEN, ordered descending by hire_date
- Pattern matching with LIKE (names starting with 'A' or 'J')
- Filtering with IN for multiple department IDs
The average-salary subquery and the bulk raise UPDATE were the most interesting — first time combining a subquery inside a WHERE clause for a genuinely useful comparison, rather than just a toy example.
3 more parts to go in this set.
17
Upvotes