当前位置:网站首页>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.
边栏推荐
- Network security - cracking system passwords
- Take you ten days to easily complete the go micro service series (II)
- [camera topic] how to save OTP data in user-defined nodes
- 【数据挖掘】任务3:决策树分类
- Some functions of applet development
- Learn BeanShell before you dare to say you know JMeter
- Network security - scanning and password explosion 2
- 网络安全-中间人攻击
- Why can't the start method be called repeatedly? But the run method can?
- DML Foundation
猜你喜欢
Anna: Beibei, can you draw?
技术大佬准备就绪,话题C位由你决定
Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly
【數據挖掘】任務6:DBSCAN聚類
Vant implements a simple login registration module and a personal user center
深度学习笔记(持续更新中。。。)
Ni visa fails after LabVIEW installs the third-party visa software
PS去除水印详解
[shutter] animation animation (animatedbuilder animation use process | create animation controller | create animation | create components for animation | associate animation with components | animatio
小程序開發的部分功能
随机推荐
Introduction to kotlin collaboration
Network security ACL access control list
网络安全-浅谈安全威胁
One of the C language practical projects is greedy snake
Query product cases - page rendering data
The testing process that software testers should know
[shutter] animation animation (animatedwidget animation use process | create animation controller | create animation | create animatedwidget animation component | animation operation)
网络安全-防火墙
Modify table structure
"Jetpack - livedata parsing"
2022-02-15 reading the meta module inspiration of the influxdb cluster
网络安全-信息收集
Function definition and call, this, strict mode, higher-order function, closure, recursion
Depth (penetration) selector:: v-deep/deep/ and > > >
Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題
网络安全-破解系统密码
【Camera专题】HAL层-addChannel和startChannel简析
Anna: Beibei, can you draw?
Return the only different value (de duplication)