Question #261

Author: admin
tags: SQL   backend  
Some table in DB:
CREATE TABLE users (
  id serial PRIMARY KEY,
  name varchar(100),
  city_name varchar(100),
  year integer
);

INSERT INTO users (name, city_name, year) VALUES
  ('Alex', 'Santiago', 1985)
  ,('Sam', 'Salvador', 2004)
  ,('Max', 'Lima', 1970)
  ,('Tom', 'Santiago', 2003)
  ,('Bob', 'Lima', 1970)
  ,('Ali', 'Salvador', 1999)
;
Is the SQL query below correct?
SELECT city_name, year
FROM users
WHERE year < 2000
GROUP BY city_name
ORDER BY year DESC;
Yes
No, the "id" column must be added to SELECT
No, the "year" column must be added to GROUP BY clause
No, "GROUP BY" must be written at the end of the SQL query
No, "WHERE" syntax is wrong
No, list of selected column names must be parenthesized
Rate the difficulty of the question:
easyhard