当前位置:网站首页>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
边栏推荐
- Modify the number of Oracle connections
- [Qunhui] command line acme SH automatically apply for domain name certificate
- Laravel pay payment access process
- Zhubo Huangyu: all the precious metals you want to know are here
- redis集群的方式
- Performance test comparison between PHP framework jsnpp and thinkphp6
- Install Damon database
- 排序查询
- Mobile terminal pull-down loading pull-down loading data
- 基础查询
猜你喜欢
![[Qunhui] this suite requires you to start PgSQL adapter service](/img/fb/1aea7eb833afc1a24531b612a98400.jpg)
[Qunhui] this suite requires you to start PgSQL adapter service

CTF PHP audit bypasses filtering learning from topics

记录一次循环引用的问题
![[Qunhui] Internet access + custom port](/img/7d/c00caeade209a48c8f44a4fecb59d5.jpg)
[Qunhui] Internet access + custom port

Zhimeng CMS will file a lawsuit against infringing websites

1.16 learning summary

一幅脑图总结一下需求分析(工作上实际遇到的情况的补充)

TP5 distinct method paging problem

Dameng database backup and restore

Minecraft 1.16.5 biochemical 8 module 1.9 version 1.18 version synchronization
随机推荐
[Qunhui] this suite requires you to start PgSQL adapter service
35岁程序员炒Luna 千万资产3天归零,网友:和赌博一样
Multipass中文文档-远程使用Multipass
numpy 数据输入输出
LeetCode 94. Middle order traversal of binary tree
Zhubo Huangyu: you can try these non-agricultural operation skills
Thinkphp6 parsing QR code
Simple personal summary of tp6 multi application deployment -- Part I [original]
Navicat connects the pit of shardingsphere sub table and sub library plug-ins
Microsoft prohibits Russian users from downloading and installing win10/11
1.17 learning summary
Advanced learning of MySQL (learning from Shang Silicon Valley teacher Zhou Yang)
How to use the configured slave data source for the scheduled task configuration class scheduleconfig
MySQL enable logbin in Qunhui docker
Analysis report on the development trend and operation status of China's environmental monitoring instrument industry from 2022 to 2028
ctf [RoarCTF 2019]easy_ calc
[H5 development] 01 take you to experience H5 development from a simple page ~ the whole page implementation process from static page to interface adjustment manual teaching
What are the advantages and risks of paper gold investment
What should I do if I don't understand the precious metal indicators
做软件测试学历重要还是能力重要