sqlbeginner10 minutes
Fix the Bug in SQL Query Filtering Customers by Age
A beginner-level debugging challenge where you must identify and fix the error in a SQL query that aims to select customers age 18 and older.
Challenge prompt
You are given a SQL query that is supposed to return all customers aged 18 or older from a Customers table. However, the query is not returning the correct results. Find and fix the bug in the query so that it correctly filters for customers whose age is at least 18.
Guidance
- • Check the WHERE clause for any syntax or logical errors.
- • Verify the comparison operator used for filtering by age.
Hints
- • Make sure the comparison operator in the WHERE clause filters customers with age >= 18.
- • Remember that the column name should match exactly and the condition should filter out younger customers.
Starter code
SELECT * FROM Customers WHERE age > 18;Expected output
Returns all rows where age is 18 or older (inclusive), not just greater than 18.
Core concepts
WHERE clauseComparison operatorsBasic SELECT filtering
Challenge a Friend
Send this duel to someone else and see if they can solve it.