Data sorting asc, desc 1. Single field sorting order by field name Function: Which field or fields to sort by Meaning: Sorting uses the order by clause, followed by the sorting field. You can put multiple sorting fields, separated by commas. Order by default uses ascending order (asc). If there is a where clause, then order by must be placed after the where clause. (1) Sort by salary from small to large (the system defaults to small to large) For example: (2) Get employees whose job is MANAGER and sort them by salary from small to large (the system defaults to small to large) For example:
(3) The following inquiry method is wrong: select * from emp order by sal whereselect * from emp order by sal where job = 'MANAGER'; 2. Manually specify field sorting (1) Manually specify the sorting by salary from small to large (ascending keyword asc) For example: (2) Manually specify the sorting by salary from high to low (descending keyword desc) For example: 3. Sorting multiple fields (1) Sort by job and salary in descending order For example: Note: If multiple fields are used for sorting, if the sorting based on the first field is repeated, the sorting will be based on the second field; 4. Sort by field position (1) Sort by salary in ascending order (this method is not recommended, as the meaning of the numbers is unclear, readability is poor, and the program is not robust) select * from emp order by 6; The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: JavaScript implements the nine-grid mobile puzzle game
>>: How to run a project with docker
Configuration Preface Project construction: built...
Table of contents 1. Event delegation Event Bubbl...
<body> <div id="root"> <...
Copy code The code is as follows: <iframe src=...
1: What is openssl? What is its function? What is...
Table of contents Scenario Core Issues Status mon...
Introduction Part 1: Written at the beginning One...
Today is another very practical case. Just hearin...
1. AIDE AIDE (Advanced Intrusion Detection Enviro...
Table of contents Join syntax: 1. InnerJOIN: (Inn...
A design soldier asked: "Can I just do pure ...
Table of contents Preface environment Install Cre...
Common nmcli commands based on RHEL8/CentOS8 # Vi...
Enable remote access rights for mysql By default,...
This article shares the specific code of JS to ac...