当前位置:网站首页>MySQL learning 03
MySQL learning 03
2022-07-03 01:56:00 【88 year old programming with injury】
MySQL
Sorting and paging operations
1. Sort
The default order of query in the database is the order of data addition
Use order by Sort the queried data
Before ordering :
Ascending sort (ASC):
order by What do you want to sort
SELECT * FROM list
ORDER BY salary;
null (DESC):
order by What do you want to sort DESC
SELECT * FROM list
ORDER BY salary DESC;

Be careful :
1. Column aliases can only be used in ORDER BY Use in , Can't be in WHERE Use in , Otherwise, an error will be reported .
2. When inquiring WHERE Should and FROM together , After use ORDER BY, That is, select first and then sort .
2. paging
Why do I need paging ?


The above is the page of a website .
How to perform paging operation ?
mysql Use limit To display the data in pages .
Usage method :limit Offset start point , Offset ;
Need one : Twenty records per page , The first page is displayed 
Demand two : Twenty records per page , The second page... Is displayed 
summary :
expand :
Multi-table query



Find the table associated with it through the content of a table, and then find the data you want , Here's the picture
The arrow points to .
Single selected execution , Slow query time , The efficiency is not high , We should exchange information on the Internet many times . Here's the picture :
How to query multiple tables ?
By default, the data of two tables are Cartesian multiplied , Each data will be paired with the data of another table one by one .
The reason for the error : The connection condition of multiple tables is missing .
Correct implementation

Connection conditions are required .
Equivalent connection and self connection
Classification of multi table query :
Non equivalent connection : Simply put, it's a range , I don't know the specific data 
Self connection is the data connection in your own table
As the name suggests, non self connection is the data connection with other tables
SQL92 And 99 Syntax realizes inner connection and outer connection
Internal connection and external connection :
The left outer join : In addition to the rows that meet the conditions, the two tables also return the rows that do not meet the conditions in the left table .
Right connection : In addition to the rows that meet the conditions, the two tables also return the rows that do not meet the conditions in the right table .
MySQL I won't support it SQL92 The external connection in grammar :
SQL99 grammar
use join…on To realize internal connection

The left outer join :LEFT OUTER JOIN…ON
Right connection :RIGHT OUTER JOIN…ON
Full outer join :MYSQL Full external connection is not supported , grammar :FULL OUTER JOIN…ON.
边栏推荐
- 【数据挖掘】任务1:距离计算
- Analysis, use and extension of open source API gateway apisex
- Groovy, "try with resources" construction alternative
- Network security - Information Collection
- PS remove watermark details
- Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance o
- Network security - scan
- Technology sharing | Frida's powerful ability to realize hook functions
- Button button adaptive size of wechat applet
- 网络安全-NAT网络地址转换
猜你喜欢

【数据挖掘】任务1:距离计算

Vant implements a simple login registration module and a personal user center

¢ growth path and experience sharing of getting an offer

A 30-year-old software tester, who has been unemployed for 4 months, is confused and doesn't know what to do?

【Camera专题】手把手撸一份驱动 到 点亮Camera

Visualisation de l'ensemble de données au format yolov5 (fichier labelme json)

Ni visa fails after LabVIEW installs the third-party visa software

Virtual list

STM32 - introduction of external interrupts exti and NVIC

可視化yolov5格式數據集(labelme json文件)
随机推荐
Network security - cracking system passwords
【Camera专题】OTP数据如何保存在自定义节点中
全链路数字化转型下,零售企业如何打开第二增长曲线
Everything file search tool
String splicing function of MySQL
How is the mask effect achieved in the LPL ban/pick selection stage?
Custom components, using NPM packages, global data sharing, subcontracting
微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題
Visualisation de l'ensemble de données au format yolov5 (fichier labelme json)
How do browsers render pages?
Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
[data mining] task 6: DBSCAN clustering
深度(穿透)选择器 ::v-deep/deep/及 > > >
Problems encountered in small program development of dark horse shopping mall
NCTF 2018 part Title WP (1)
【数据挖掘】任务3:决策树分类
Everything文件搜索工具
网络安全-破解系统密码
Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly
Vant implements a simple login registration module and a personal user center