当前位置:网站首页>Summary of MySQL basic knowledge points
Summary of MySQL basic knowledge points
2022-06-28 09:48:00 【Autonomous watermelon L】
1. What is a database ?
A database is a collection of data stored in an organized way .
One of the easiest ways to understand a database is to think of it as a file cabinet . This file cabinet is a physical location for storing data , No matter what the data is and how it is organized .
2. The concept of table
A table is a structured list of a particular type of data .
Key points : Data stored in a table is a type of data or a list . Never store the list of customers and the list of orders in the same database table . Doing so will make it difficult to retrieve and access later , Two tables should be created , One table per list .
Be careful : Each table in the database has a name , To identify yourself . This name is unique . You can use the same table name in different databases .
3. Can't use part of DISTINCT
DISTINCT Keyword applies to all columns, not just the columns that precede it . If given SELECT DISTINCT id,money, Unless both columns specified are different , Otherwise all rows will be retrieved .
4.MYSQL 5 Of LIMIT grammar
LIMIT 3,4 The meaning of is not very clear , It is easy to confuse people , It means from the line 3 At the beginning 4 That's ok . But it's easy to remember backwards
For this reason ,MYSQL 5 Support LIMIT Another alternative grammar for .
LIMIT 4 OFFSET 3 It means from the line 3 Began to take 4 That's ok , It's like LIMIT 3,4 equally .
5. Sorting and retrieving data order by
One thing to note is that , It is often necessary to sort data by more than one column . for example , If you want to display a list of employees , You may want to sort by last name and first name ( First, sort by surname , Then sort by first name in each surname ).
If more than one employee has the same last name , It's easy to use .
To sort by multiple columns , Just specify the column name , Separate column names with commas ( Just like selecting multiple columns ).
Specify sorting direction :
Data sorting is not limited to ascending sorting ( from A To Z). This is the default sort order , You can also use ORDER BY Clauses in descending order ( from Z To A) Order . For descending sort , Must specify DESC keyword .
6. Mismatch check
Example : List not 303 Name of the class SELECT class_id,name From student WHERE class_id <> 303
Be careful : Use != and <> The effect is the same .
7. Order of calculation
WHERE Can contain any number of AND and OR The operator . Allow both to be combined for complex and advanced filtering .
SQL Like most languages, it deals with OR Before the operator , priority AND The operator .
8. Why use IN The operator ? Advantages as follows :
a. When using a long list of legal options ,IN Operator syntax is clearer and more intuitive ;
b. In the use of IN when , The order of calculations is easier to manage ( Because fewer operators are used );
c.IN Operator general ratio OR Faster operator list execution ;
d.IN The biggest advantage is that it can contain other SELECT sentence , Make it possible to dynamically create WHERE Clause .
边栏推荐
- Which occupational groups are suitable for the examination
- 缓存之王Caffeine Cache,性能比Guava更强
- 微信小程序开发日志
- Summary of PMP learning experience
- On the influence of small program on the digitalization of media industry
- 代理模式(Proxy)
- Xiaomi's payment company was fined 120000 yuan, involving the illegal opening of payment accounts, etc.: Lei Jun is the legal representative, and the products include MIUI wallet app
- How to view the web password saved by Google browser
- MySQL基础知识点总结
- Abnormal occurrence and solution
猜你喜欢

bye! IE browser, this route edge continues to go on for IE

PyGame game: "Changsha version" millionaire started, dare you ask? (multiple game source codes attached)
![[ybtoj advanced training guidance] class roll call [string hash]](/img/5b/bbf8fa51d180b50fbbee4bcc278c70.jpg)
[ybtoj advanced training guidance] class roll call [string hash]

Starting from full power to accelerate brand renewal, Chang'an electric and electrification products sound the "assembly number"

小米旗下支付公司被罚 12 万,涉违规开立支付账户等:雷军为法定代表人,产品包括 MIUI 钱包 App

Xiaomi's payment company was fined 120000 yuan, involving the illegal opening of payment accounts, etc.: Lei Jun is the legal representative, and the products include MIUI wallet app

File operations in QT

Bridge mode

Global exception handlers and unified return results

1181: integer parity sort
随机推荐
Sword finger offer | linked list transpose
老板叫我写个APP自动化--Yaml文件读取--内附整个框架源码
abnormal
PMP考试重点总结八——监控过程组(2)
Dolphin scheduler uses system time
组合模式(Composite Pattern)
Proxy mode (proxy)
Summary of PMP learning experience
PyGame game: "Changsha version" millionaire started, dare you ask? (multiple game source codes attached)
数字人行业爆发在即,市场格局几何?
结巴分词器_分词器原理
六月集训(第28天) —— 动态规划
Write a simple timeline
The digital human industry is about to break out. What is the market pattern?
Unity 从服务器加载AssetBundle资源写入本地内存,并将下载保存的AB资源从本地内存加载至场景
1181: integer parity sort
优秀笔记软件盘点:好看且强大的可视化笔记软件、知识图谱工具Heptabase、氢图、Walling、Reflect、InfraNodus、TiddlyWiki
Installing redis under Linux and windows (ultra detailed graphic tutorial)
Static page of pinyougou mall
Numpy array: join, flatten, and add dimensions