Consider the below given query SELECT column_name(s) FROM table1 command…

2025

Consider the below given query

SELECT column_name(s) FROM table1

command

SELECT column_name(s) FROM table2;

What should the database manager write in place of command to get distinct values from table1 and table2 of column_name(s)?

  1. A.

    SET DIFFERENCE

  2. B.

    DISTINCT

  3. C.

    UNION

  4. D.

    UNION ALL

Attempted by 858 students.

Show answer & explanation

Correct answer: C

Ans C

Solution

The UNION operator selects only distinct values by default. To allow duplicate values, use UNION ALL:

Explore the full course: Cognizant Preparation