Fill the appropriate clause in the below SQL code to retrieve all columns from the 'customers' table where country is equal to 'USA' and city is equal to 'New York'.
SELECT * _____ customers WHERE COUNTRY = 'USA' AND CITY = 'NEW YORK'
Fill the appropriate clause in the below SQL code to retrieve all columns from the 'customers' table where country is equal to 'USA' and city is equal to 'New York'.
SELECT * _____ customers WHERE COUNTRY = 'USA' AND CITY = 'NEW YORK'
Solution
The blank sits between the column list and the table name, so it needs the FROM clause. In SQL, FROM names the table to read data from, giving the structure SELECT columns FROM table WHERE condition.
Here, SELECT * picks all columns, FROM customers picks the table, and WHERE COUNTRY = 'USA' AND CITY = 'NEW YORK' filters the rows.
Option 2: WHERE is already used later in the query to filter rows. It cannot replace FROM, because the table name must be given first.
Option 3: HAVING filters groups after GROUP BY, and it does not specify a table.
Option 4: COUNT is an aggregate function, not a clause.
Related questions:
2025: 30 May Shift 2
2026: 23 May Shift 2
2025: 13 May Shift 2