If in Table "employee", a column "emp_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 emp_id
FROM employee;
SELECT DISTINICT emp_id
FROM employee;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 how MySQL's DISTINCT keyword works.Imagine you have a table called "employee" with a column named "emp_id". This column stores employee IDs. The table has these IDs: {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}.
The SQL statement `SELECT DISTINCT emp_id FROM employee;` means you want to get a list of all the unique "emp_id" values from the table. This means it will remove any duplicate IDs.
So, the correct answer is Option B: {1,2,3,5,6,7,8} because this shows only the unique employee IDs, removing the duplicate entries.

Join The Discussion