Given the nums table:
id | num
---+----
1  | 1
2  | null
3  | 2
2  | null
3  | 5
3  | 7
Which of the following queries will return exactly 3 records in a result set? Select all that apply.
Explanation
SELECT 3 FROM nums;
will return 6 records consisting of number "3".
SELECT id FROM nums;
will return all ids from the table (6 records).
SELECT num FROM nums WHERE num IS NOT NULL;
will return 6 records.
SELECT COUNT(DISTINCT id) FROM nums;
will return 1 record containing "3" in it.
SELECT DISTINCT id FROM nums WHERE num IS NOT NULL;
will return only 2 records.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes