Examveda

What is the significance of "ORDER BY" in the following MySQL statement?
SELECT emp_id, fname, lname
FROM person
ORDER BY emp_id;

A. Data of emp_id will be sorted

B. Data of emp_id will be sorted in descending order

C. Data of emp_id will be sorted in ascending order

D. All of the mentioned

Answer: Option A

Solution (By Examveda Team)

The "ORDER BY" clause in a MySQL statement is like telling the database to arrange the results in a specific order.
In this case, "ORDER BY emp_id" means the results will be sorted based on the values in the "emp_id" column.
By default, the sorting is done in ascending order, meaning the lowest values of "emp_id" will appear first.
So the answer is Option C: Data of emp_id will be sorted in ascending order.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous