当前位置:网站首页>Basic knowledge of mysql (2)
Basic knowledge of mysql (2)
2022-07-31 04:01:00 【shortage--】
1. Sorting rules
Use ORDER BY clause to sort
ASC (ascend): ascending order
DESC (descend): descending order
ORDER BY clause in SELECTthe end of the statement.
We can use column aliases to sortSELECT employee_id,salary,salary * 12 annual_salFROM employeesORDER BY annual_sal;#Note: Column aliases can only be used in ORDER BY, not in WHERE.#The following operation reports an error!SELECT employee_id,salary,salary * 12 annual_salFROM employeesWHERE annual_sal > 81600;Second, paging
LIMIT is used in MySQL to implement paging
Format: LIMIT [position offset,] number of rows
#Requirement: display pageSize records per page,The pageNo page is displayed:
#Formula:
SELECT * FROM table LIMIT(PageNo - 1)*PageSize,PageSize;
Note: The LIMIT clause must be placed at the end of the entire SELECT statement!
The benefits of using LIMIT
Constraining the number of returned results can reduce the network traffic of the data table and improve query efficiency.
If we know that there is only one result returned, we can use LIMIT 1 to tell the SELECT language
边栏推荐
- [C language] Preprocessing operation
- LeetCode每日一练 —— OR36 链表的回文结构
- (六)枚举、注解
- 进程间通信
- 立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
- 「 每日一练,快乐水题 」1331. 数组序号转换
- $attrs/$listeners
- (Line segment tree) Summary of common problems of basic line segment tree
- Thinking about data governance after Didi fines
- Know the showTimePicker method of the basic components of Flutter
猜你喜欢
![[C language] Three-pointed chess (classic solution + list diagram)](/img/64/18ed08b64f9618bbd7f24ee16e6a6f.jpg)
[C language] Three-pointed chess (classic solution + list diagram)

web容器及IIS --- 中间件渗透方法1

Safety 20220712

浅识Flutter 基本组件之CheckBox组件

Database implements distributed locks

Unity2D 自定义Scriptable Tiles的理解与使用(四)——开始着手构建一个基于Tile类的自定义tile(下)

idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘

Mysql 45 study notes (twenty-four) MYSQL master-slave consistency

What is a system?

With 7 years of experience, how can functional test engineers improve their abilities step by step?
随机推荐
No qualifying bean of type 问题
Automation strategies for legacy systems
[CV project debugging] CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT problem
Learning DAVID Database (1)
Web container and IIS --- Middleware penetration method 1
volatile内存语义以及实现 -volatile写和读对普通变量的影响
Why don't you programmers make a living off your own projects?And have to work for someone else?
IDEA comment report red solution
MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
【C语言进阶】文件操作(一)
【AUTOSAR-RTE】-4-Port and Interface and Data Type
[C language] General method of base conversion
【论文阅读】Mastering the game of Go with deep neural networks and tree search
[Paper reading] Mastering the game of Go with deep neural networks and tree search
从滴滴罚款后数据治理思考
ClickHouse: Setting up remote connections
PMP WeChat group daily exercises
Safety 20220709
Redis counts new and retained users
qlib自动化quant