MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What does UNION operator do in a SQL statement?
A
Bring all distinct from the listed tables
B
Bring all data from the listed tables
C
Bring data which is not common from the listed tables
D
Bring common data from the listed tables
Explanation: 

Detailed explanation-1: -The UNION operator is used to combine the result-set of two or more SELECT statements. Notice that each SELECT statement within the UNION must have the same number of columns. The columns must also have similar data types. Also, the columns in each SELECT statement must be in the same order.

Detailed explanation-2: -1. What is the function of the union operation? Explanation: The union operation combines the results of two different queries which have the same set of attributes in the select clause. It automatically eliminates duplicates.

Detailed explanation-3: -What is true about the UNION ALL operator? Answer: C. UNION ALL Returns the combined rows from two queries without sorting or removing duplicates.

Detailed explanation-4: -UNION or UNION ALL have the same basic requirements of the data being combined: There must be the same number of columns retrieved in each SELECT statement to be combined. The columns retrieved must be in the same order in each SELECT statement.

Detailed explanation-5: -Generally the UNION ALL command is quite similar to the UNION command-the only difference is that UNION ALL selects all values. In other words, UNION ALL will not remove duplicate rows. Instead, it will fetch all rows matching the query and combine them in a result table.

There is 1 question to complete.