- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we get sorted output based on multiple columns?
152 Lectures 16 hours
87 Lectures 5.5 hours
We can specify multiple columns in ORDER BY clause to get the sorted output based on those multiple columns. Following as an example to make this concept clearer −
mysql> Select * from Student ORDER BY Name, Address; +------+---------+---------+-----------+ | Id | Name | Address | Subject | +------+---------+---------+-----------+ | 2 | Aarav | Mumbai | History | | 1 | Gaurav | Delhi | Computers | | 15 | Harshit | Delhi | Commerce | | 17 | Raman | Shimla | Computers | +------+---------+---------+-----------+ 4 rows in set (0.12 sec)
- How can we get the sorted MySQL output?
- How can we assign FOREIGN KEY constraint on multiple columns?
- How can we set PRIMARY KEY on multiple columns of a MySQL table?
- Find the mean of multiple columns based on multiple grouping columns in R data frame.
- How can we set PRIMARY KEY on multiple columns of an existing MySQL table?
- How can we sort multiple columns in a single query?
- How can we update columns values on multiple rows with a single MySQL UPDATE statement?
- How to get services based on multiple conditional parameters in PowerShell?
- How to create a subset of an R data frame based on multiple columns?
- How can we remove composite PRIMARY KEY constraint applied on multiple columns of an existing MySQL table?
- How can I get the output based on comparison done with column’s name using MySQL IN() function?
- How can we fetch one or more columns as output from a MySQL table?
- How to find the mean of multiple columns based on a character column in R?
- How to subset rows based on criterion of multiple numerical columns in R data frame?
- How can I get the output of multiple MySQL tables from a single query?