当前位置:网站首页>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 .
边栏推荐
- Bridge mode
- Two interview demo
- PMP考试重点总结四——规划过程组(2)
- 代理模式(Proxy)
- Write a simple timeline
- Redis sentinel cluster main database failure data recovery ideas # yyds dry goods inventory #
- June 27, 2022: give a 01 string with a length of N. now please find two intervals so that the number of 1 is equal and the number of 0 is equal in the two intervals. The two intervals can intersect bu
- 剑指Offer | 斐波那契数列
- Edit the live broadcast source code with me. How to write the live broadcast app code
- Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m
猜你喜欢

JVM family (2) - garbage collection

Interpretation of new products: realm launched GT neo2 Dragon Ball customized version

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

用 Compose 实现个空调,为你的夏日带去清凉

TCP实战案例之即时通信、BS架构模拟

Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m

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

Looking at jBPM from jbm3 to jbm5 and activiti

Dolphin scheduler uses system time

适配器模式(Adapter)
随机推荐
结巴分词器_分词器原理
Ingersoll Rand面板维修IR英格索兰微电脑控制器维修XE-145M
QT signal and slot communication mechanism (when multiple windows communicate back and forth [parent and child windows])
Ingersoll Rand panel maintenance IR Ingersoll Rand microcomputer controller maintenance xe-145m
优秀笔记软件盘点:好看且强大的可视化笔记软件、知识图谱工具Heptabase、氢图、Walling、Reflect、InfraNodus、TiddlyWiki
01 distributed system overview
Numpy array: join, flatten, and add dimensions
==和eqauls()的区别
Do static code blocks always execute first? The pattern is smaller!!!
Custom exception classes and exercises
JVM family (2) - garbage collection
1181:整数奇偶排序
When the interviewer asks you to write binarysort in two ways
Adapter mode
The constructor is never executed immediately after new()!!!!!
装饰模式(Decorator)
Restful style
Interpretation of new products: realm launched GT neo2 Dragon Ball customized version
Au revoir! Navigateur ie, cette route Edge continue pour IE
大纲笔记软件 Workflowy 综合评测:优点、缺点和评价