当前位置:网站首页>MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
2022-07-07 08:26:00 【Ghost Knight】
List of articles
CRUD
create,read,update,delete
- Insert sentence ( Add data )
- Update sentence ( UPDATE statement )
- Delete sentence ( Delete data )
- Select sentence ( Find data )
Insert sentence
Introductory cases
details
Update sentence
Introductory cases
details
- UPDATE Syntax to update columns in the original table row with new values .
- SET Clause to indicate which columns to modify and which values to give .
- WHERE Clause specifies which rows should be updated . If not WHERE Clause , Then update all
That's ok ( Record ), So the teacher reminds you to be careful .
4. If you need to modify multiple fields , Can pass set Field 1 = value 1, Field 2- value …
update employee set salary = salary + 1000,job = ' Mountain patrolling ' where name = ' Old monster '
Delete sentence
Introductory cases
details
- If not used where Clause , All data in the table... Will be deleted .( Be careful )
- Delete Statement cannot delete a - The value of the column ( You can use update Set to null perhaps ’ ')
- Use delete Statement only delete records , Don't delete the table itself . To delete a table , Use droptable sentence .drop table Table name ;
drop table employee;
Select sentence 【 a key 】( Single table , Multiple tables )
matters needing attention
- Select Specify which columns of data to query .
- column Specifies the column name .
- * Number means to query all columns .
- From Specify which table to query .
- DISTINCT Optional , When the result is displayed , Whether to remove duplicate data
Case practice
Create student table first
CREATE TABLE student (
id INT NOT NULL DEFAULT 1,
NAME VARCHAR ( 20 ) NOT NULL DEFAULT '',
chinese FLOAT NOT NULL DEFAULT 0.0,
english FLOAT NOT NULL DEFAULT 0.0,
math FLOAT NOT NULL DEFAULT 0.0
);
INSERT INTO student
VALUES
( 1, ' Taotao ', 98, 78, 90 );
INSERT INTO student
VALUES
( 2, ' Zhang Fei ', 87, 50, 80 );
INSERT INTO student
VALUES
( 3, ' Guan yu ', 91, 28, 30 );
Expression column
as sentence ( nickname )
Case practice
where Clause common operators
Case practice 1
Case practice 2
Order by Clause
Basic introduction
- Order by Specify sorted columns , The sorted column can be either the column name in the table , It can also be select The column name specified after the statement
- Asc Ascending [ Default ]、Desc Descending
- ORDER BY Clause should be in SELECT End of statement
Case presentation
边栏推荐
- Myabtis_ Plus
- Splunk query CSV lookup table data dynamic query
- Opencv learning note 3 - image smoothing / denoising
- Analyzing the influence of robot science and technology development concept on Social Research
- The single value view in Splunk uses to replace numeric values with text
- Zcmu--1492: problem d (C language)
- CCTV is so warm-hearted that it teaches you to write HR's favorite resume hand in hand
- DeiT学习笔记
- 在Rainbond中实现数据库结构自动化升级
- Practice of implementing cloud native Devops based on rainbow library app
猜你喜欢
Improve the delivery efficiency of enterprise products (1) -- one click installation and upgrade of enterprise applications
Splunk子查询模糊匹配csv中字段值为*
Explore creativity in steam art design
[quick start of Digital IC Verification] 13. SystemVerilog interface and program learning
Use of JMeter
opencv学习笔记五——梯度计算/边缘检测
XCiT学习笔记
Opencv learning note 4 - expansion / corrosion / open operation / close operation
Interpreting the practical application of maker thinking and mathematics curriculum
在Rainbond中一键部署高可用 EMQX 集群
随机推荐
Detailed explanation of apply, also, let, run functions and principle analysis of internal source code in kotlin
接口作为参数(接口回调)
opencv学习笔记二——图像基本操作
JS copy picture to clipboard read clipboard
Deit learning notes
SSM 整合
Opencv learning notes 1 -- several methods of reading images
MES system is a necessary choice for enterprise production
发挥创客教育空间的广泛实用性
Infix keyword infix expression and the use of generic extension function in kotlin
Four items that should be included in the management system of integral mall
解读创客思维与数学课程的实际运用
Interview questions (CAS)
Le système mes est un choix nécessaire pour la production de l'entreprise
【无标题】
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Explore creativity in steam art design
Standard function let and generic extension function in kotlin
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
CCTV is so warm-hearted that it teaches you to write HR's favorite resume hand in hand