Multiple choice technology programming languages

Which SQL statement is used to return only different values?

  1. SELECT UNIQUE

  2. SELECT DIFFERENT

  3. SELECT DISTINCT

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

SELECT DISTINCT is used to return only unique (different) values, eliminating duplicates from the result set. 'SELECT UNIQUE' and 'SELECT DIFFERENT' are not valid SQL syntax.

AI explanation

To answer this question, you need to understand the purpose of the SQL statement used to return only different values.

Option A) SELECT UNIQUE - This option is incorrect because there is no "UNIQUE" keyword in SQL for selecting only different values. The "UNIQUE" keyword is used in the table definition to enforce uniqueness on a column or set of columns.

Option B) SELECT DIFFERENT - This option is incorrect because there is no "DIFFERENT" keyword in SQL for selecting only different values.

Option C) SELECT DISTINCT - This option is correct because the "DISTINCT" keyword is used in SQL to return only different values. It eliminates duplicate values from the result set, returning only unique values.

Option D) None of the above - This option is incorrect because option C, "SELECT DISTINCT," is the correct SQL statement for returning only different values.

The correct answer is C) SELECT DISTINCT. This option is correct because the "DISTINCT" keyword is used in SQL to return only different values by eliminating duplicates from the result set.