?
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?
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;
SELECT DISTINICT cust_id
FROM account;
Answer & Solution
Correct Answer:
Option
B
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:
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.
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.
Join the Discussion
Login to post a comment or share your explanation.
Login