SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);
Explanation: The subquery gets the highest salary; the outer query finds the max below that.
Dear candidates you will find MCQ questions of MySQL here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);
Explanation: The subquery gets the highest salary; the outer query finds the max below that.
Explanation: `DISTINCT` ensures the returned values are unique.
SELECT COUNT(DISTINCT country) FROM customers;
Explanation: `COUNT(DISTINCT column)` counts only unique values in the column.
Explanation: `ROUND()` rounds a number to the specified number of decimal places.
Explanation: `GROUP BY` is used to group rows with the same values for aggregate functions.