当前位置:网站首页>Sort query
Sort query
2022-06-26 04:38:00 【Lili demon_】
Sort query
Sort query :SELECT Query list FROM surface WHERE filter ORDER BY Sort list (ASC/DESC)AEC/DESC = Ascending / Descending , The default is ascending ORDER BY Support Single field 、 Multiple fields 、 expression 、 function 、 Alias
Sort by a single field
#1. Query employee information , We need to rank wages from high to low
SELECT *
FROM employees
ORDER BY salary DESC
#2. Query department number is greater than or equal to 90 Employee information , Sort them by the time they are employed
SELECT *
FROM employees
WHERE department_id >= 90
ORDER BY hiredate ASC
By expression / Alias sort
#3. Display employee information and annual salary according to the level of annual salary 【 Sort by expression 】
SELECT *,salary*12*(1+IFNULL(commission_pct,0)) AS " Annual salary "
FROM employees
ORDER BY " Annual salary " DESC
Sort by function
#4. Display the employee's name and salary according to the length of the name 【 Sort by function 】
SELECT LENGTH(last_name) AS " bytes ",last_name,salary
FROM employees
ORDER BY LENGTH(last_name) DESC
Sort by multiple fields
#5. Query employee information , It is required to be in ascending order of salary first , In descending order by employee number 【 Sort by multiple fields 】
SELECT *
FROM employees
ORDER BY salary ASC,employee_id DESC
边栏推荐
- PHP installation SSH2 extension
- 35岁程序员炒Luna 千万资产3天归零,网友:和赌博一样
- [Qunhui] this suite requires you to start PgSQL adapter service
- SSH password free login, my server password free login to the other server, the other server password free login to your server
- Essential foundation of programming - Summary of written interview examination sites - computer network (1) overview
- Ueeditor automatically appends P tags to rich text.br tags always wrap.br tag solutions
- Yapi cross domain request plug-in installation
- Thinkphp6 implements a simple lottery system
- redis集群的方式
- Laravel framework Alipay payment fails to receive asynchronous callback request [original]
猜你喜欢

Tp6 controller does not exist: app\index\controller\index

How to use the configured slave data source for the scheduled task configuration class scheduleconfig

Clickhouse stand alone installation

Install SVN in Pagoda and build SVN version Library
![Simple personal summary of tp6 multi application deployment -- Part I [original]](/img/7b/65fab1973423081483dacc9bed9594.jpg)
Simple personal summary of tp6 multi application deployment -- Part I [original]

Install dbeaver and connect Clickhouse

企业的产品服务怎么进行口碑营销?口碑营销可以找人代做吗?

Mysql8.0 configuring my SQL in INI file_ mode=NO_ AUTO_ CREATE_ User can start

Database design (I)
![Tp6 is easy to tread [original]](/img/e9/4b2fbd485387c5ed9e75bd0451a19c.jpg)
Tp6 is easy to tread [original]
随机推荐
[Qunhui] command line acme SH automatically apply for domain name certificate
Thinkphp6 using kindeditor
Yapi cross domain request plug-in installation
排序查询
条件查询
防撤回测试记录
The statistics in the MySQL field become strings, and then they are converted into numbers for sorting
Install cenos in the virtual machine
numpy 数据输入输出
"Eight hundred"
[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions
Multipass中文文档-提高挂载性能
Guide de la pompe de données Oracle
[geek challenge 2019] rce me
Redis cluster mode
Svn error command revert error previous operation has not finished; run ‘ cleanup‘ if
Ueeditor automatically appends P tags to rich text.br tags always wrap.br tag solutions
Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
Laravel file stream download file
微软禁止俄用户下载安装Win10/11