Examveda

If in Table "account", a column "cust_id" consists of {1,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following MySQL statement?
SELECT DISTINICT cust_id
FROM account;

A. {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}

B. {1, 2, 3, 5, 6, 7, 8}

C. { }

D. None of the mentioned

Answer: Option B

Solution (By Examveda Team)

This question is about the DISTINCT keyword in MySQL.
The DISTINCT keyword is used to remove duplicate values from the result set of a query.
In this case, we are selecting the cust_id column from the "account" table using the following query:
SELECT DISTINCT cust_id
FROM account;

The cust_id column has the following values: {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}.
Since we are using the DISTINCT keyword, the query will only return the unique values from the cust_id column.
Therefore, the output of the query will be: {1, 2, 3, 5, 6, 7, 8}.
So the correct answer is Option B.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous