
Answer-first summary for fast verification
Answer: SELECT user_id, email_address FROM my_table WHERE age > 25 AND country = ’Canada’;
The question requires selecting only the user_id and email_address columns with filters for age > 25 and country = 'Canada'. Option B correctly specifies these exact columns in the SELECT clause and applies the proper WHERE conditions. Option A uses SELECT * which returns all columns, violating the requirement to only return specific columns. Option C selects the wrong columns (age and country instead of user_id and email_address). Option D has incorrect filter logic (age = 25 instead of > 25 and country > 'Canada' which is invalid string comparison). The community discussion shows 100% consensus on B, confirming it's the only correct choice.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A data analyst is required to query the data in my_table. They want to return the values in columns user_id and email_address where records fit the following filter criteria: age is greater than 25 and country is Canada. The analyst does not want to return values from any other columns.
Which following SQL will accomplish the above task?
A
SELECT * FROM my_table WHERE age > 25 AND country = ’Canada’;
B
SELECT user_id, email_address FROM my_table WHERE age > 25 AND country = ’Canada’;
C
SELECT age, country FROM my_table WHERE age > 25 AND country = ’Canada’;
D
SELECT user_id, email_address FROM my_table WHERE age = 25 AND country > ’Canada’;
No comments yet.