Which query returns the names of users older than 30?
Options
- SELECT name FROM users WHERE age > 30; (Correct option)
- SELECT users WHERE age > 30;
- GET name FROM users IF age > 30;
- SELECT * FROM users HAVING age > 30 ORDER;
Answer
SELECT name FROM users WHERE age > 30;
Why
Basic SQL shape: SELECT columns FROM table WHERE condition;
- SELECT name: which columns to return (
*= all). - FROM users: which table.
- WHERE age > 30: keep only rows matching the condition.
Keywords are usually written in UPPERCASE for readability, but SQL does not require it.
Remember
SELECT what FROM where WHERE condition.