Repaso
EspaƱol

Which query returns the names of users older than 30?

Options

  1. SELECT name FROM users WHERE age > 30; (Correct option)
  2. SELECT users WHERE age > 30;
  3. GET name FROM users IF age > 30;
  4. 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.

Key terms

Practice this question in Repaso