- 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
In MySQL, how it can be possible to specify a sort order using a column that is not retrieved by the query?
Actually, as we know that we can specify a sort order with the help of the ORDER BY clause. We need to write the ORDER BY keyword followed by the name of the column on which we want to sort the table. It is not necessary that we have to use that column name after the SELECT keyword in the query.
mysql> Select Sr, Item from ratelist ORDER BY Price; +----+------+ | Sr | Item | +----+------+ | 5 | T | | 1 | A | | 2 | B | | 4 | h | | 3 | C | +----+------+ 5 rows in set (0.00 sec)
In the example above, we can observe that we need not write the name of the same column after the SELECT keyword which we write in ORDER BY keyword to sort the table. It means that the column itself would not be retrieved by MySQL query on the basis of which we have sorted out the table.
- MySQL Order By date column and integer column, but specify ordering rules of integer column? Is it possible?
- While using the ROLLUP modifier, is it possible to use a MySQL ORDER BY clause to sort the result?
- How can we sort a query using ORDER BY CASE WHEN REGEXP?
- How can it be possible to invert a string in MySQL?
- Is it possible to calculate a correlation in a MySQL query?
- Is it possible to sort varchar data in ascending order that have both string and number values with MySQL?
- What to assign to a MySQL column that must not be empty?
- Is it possible to cast in a MongoDB Query?
- Can we select row by DATEPART() in MySQL? Is it possible?
- MySQL “order by” inside of “group by”? Is it possible?
- How to write PHP script by using ORDER BY clause inside it to sort the data of MySQL table?
- How to sort by value with MySQL ORDER BY?
- How it is possible to insert a zero or an empty string into a MySQL column which is defined as NOT NULL?
- Is it possible to hack a phone by Texting?
- How can you order the result obtained by select query in MySQL?