Oracle Database MySQL 5.6 Developer — Question 1

A table (t1) contains 1000 random integer values in the first column (col1).The random values are in the range of 0-1000.
Examine this query:
SELECT col1 FROM t1 WHERE col1 <=100 UNION
SELECT col1 FROM t1 WHERE col1 >=900 ORDER BY col1 DESC
What is the expected output?

Answer options

Correct answer: B

Explanation

The correct answer is B because the query will first select all values from col1 that are less than or equal to 100 and then all values greater than or equal to 900. The UNION operator will combine these results, but since the second part is ordered, it will display the results in descending order but not sort the first part. Options A, C, and D incorrectly describe the sorting behavior and uniqueness of the values in the result set.