
Explanation:
Option A:
| age | country |
|---|---|
| 80 | canada |
| NULL | canada |
| 90 | NULL |
Incorrect.
age = NULL fails age >= 75 (NULL comparisons return unknown/false in the WHERE clause).country = NULL fails country = 'canada'.Option B:
| age | country |
|---|---|
| 80 | NULL |
| 75 | NULL |
| 90 | NULL |
Incorrect.
country = NULL, which does not equal 'canada'.country = 'canada', so these rows should be filtered out entirely.Option C:
| id | age | country |
|---|---|---|
| 900 | 80 | canada |
| 901 | 75 | canada |
| 902 | 90 | canada |
Incorrect.
age and country. It does not include the id column.Option D:
| age | country |
|---|---|
| 80 | canada |
| 14 | canada |
| 90 | canada |
Incorrect.
age = 14 fails the condition age >= 75.Option E:
| age | country |
|---|---|
| 80 | canada |
| 75 | canada |
| 90 | canada |
Correct.
age >= 75 and country = 'canada'.age and country) are returned.The correct answer is E.
This question tests fundamental SQL concepts:
Mastering these basics is essential for the Databricks Certified Data Analyst - Associate exam, as many questions revolve around correct SQL filtering, projection, and understanding query output structure. Keep practicing similar queries by mentally applying the WHERE conditions to sample data!
A data analyst runs the following command:
SELECT age, country -
FROM my_table -
WHERE age >= 75 AND country = 'canada';
SELECT age, country -
FROM my_table -
WHERE age >= 75 AND country = 'canada';
Which of the following tables represents the output of the above command?
A
| age | country |
|---|---|
| 80 | canada |
| NULL | canada |
| 90 | NULL |
B
| age | country |
|---|---|
| 80 | NULL |
| 75 | NULL |
| 90 | NULL |
C
| id | age | country |
|---|---|---|
| 900 | 80 | canada |
| 901 | 75 | canada |
| 902 | 90 | canada |
D
| age | country |
|---|---|
| 80 | canada |
| 14 | canada |
| 90 | canada |
E
| age | country |
|---|---|
| 80 | canada |
| 75 | canada |
| 90 | canada |