हिंदी

Execute the following two queries and find out what will happen if we specify two columns in the ORDER BY clause:

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 8: Introduction to Structured Query Language (SQL) - Intext Questions [पृष्ठ १६४]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
अध्याय 8 Introduction to Structured Query Language (SQL)
Intext Questions | Q 18. | पृष्ठ १६४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×