当前位置:网站首页>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 .
边栏推荐
- Numpy array: join, flatten, and add dimensions
- 手机号、邮箱正则验证[通俗易懂]
- 优秀笔记软件盘点:好看且强大的可视化笔记软件、知识图谱工具Heptabase、氢图、Walling、Reflect、InfraNodus、TiddlyWiki
- 【云驻共创】DWS告警服务DMS详细介绍和集群连接方式简介
- Instant messaging and BS architecture simulation of TCP practical cases
- Global exception handlers and unified return results
- Naming rules and specifications for identifiers
- Full link service tracking implementation scheme
- PMP Exam key summary VI - chart arrangement
- Edit the live broadcast source code with me. How to write the live broadcast app code
猜你喜欢

Proxy mode (proxy)

Dbeaver connects to kingbasees V8 (ultra detailed graphic tutorial)

new URL(“www.jjj.com“)

数字人行业爆发在即,市场格局几何?

【OpenCV 例程200篇】213. 绘制圆形

P2394 yyy loves Chemistry I
![[ybtoj advanced training guide] maximum separation [hash] [Floyd]](/img/86/542ab1728a2ddbc01592b2fa83491a.jpg)
[ybtoj advanced training guide] maximum separation [hash] [Floyd]

Dolphin scheduler uses system time
![1180:分数线划定/P1068 [NOIP2009 普及组] 分数线划定](/img/1a/162b060a6498e58278b6ca50e4953c.png)
1180:分数线划定/P1068 [NOIP2009 普及组] 分数线划定

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
随机推荐
Starting from full power to accelerate brand renewal, Chang'an electric and electrification products sound the "assembly number"
Full link service tracking implementation scheme
PMP Exam key summary VI - chart arrangement
01-分布式系统概述
详解final、finally和finalize
Unity loads AssetBundle resources from the server and writes them to local memory, and loads the downloaded and saved AB resources from local memory to the scene
1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation
ffmpeg录音录像
异常的产生,及解决
Divide and rule classic Hanoi
The concept of "tree structure" perfectly interprets the primary and secondary of things
What is online account opening? Is it safe to open an account online now?
new URL(“www.jjj.com“)
Two interview demo
Caffeine cache, the king of cache, has stronger performance than guava
Regular verification of mobile phone number and email [easy to understand]
全链路业务追踪落地实践方案
bad zipfile offset (local header sig)
结巴分词器_分词器原理
Dbeaver连接人大金仓KingbaseES V8(超详细图文教程)