Advertisements
Advertisements
प्रश्न
Execute the following two queries and find out what will happen if we specify two columns in the ORDER BY clause:
SELECT *
FROM EMPLOYEE
ORDER BY Salary,
Bonus;
SELECT *
FROM EMPLOYEE
ORDER BY Salary,Bonus
desc;कोड लेखन
Advertisements
उत्तर
SELECT *
FROM EMPLOYEE
ORDER BY Salary, Bonus;
Output: The records are arranged in ascending order of Salary. If two employees have the same Salary, they are arranged in ascending order of Bonus.
SELECT *
FROM EMPLOYEE
ORDER BY Salary, Bonus DESC;
Output: The records are arranged in ascending order of Salary. If two employees have the same Salary, they are arranged in descending order of Bonus.
DESC applies only to Bonus, the column immediately before it.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
