当前位置:网站首页>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

边栏推荐
- Infix keyword infix expression and the use of generic extension function in kotlin
- DeiT学习笔记
- CDC (change data capture technology), a powerful tool for real-time database synchronization
- [quick start of Digital IC Verification] 13. SystemVerilog interface and program learning
- Ebpf cilium practice (1) - team based network isolation
- Use of JMeter
- SSM 整合
- [step on the pit series] H5 cross domain problem of uniapp
- Vulnerability recurrence easy_ tornado
- 拓维信息使用 Rainbond 的云原生落地实践
猜你喜欢

藏书馆App基于Rainbond实现云原生DevOps的实践

BiSeNet的特点

Splunk查询csv lookup table数据动态查询
![[quick start of Digital IC Verification] 12. Introduction to SystemVerilog testbench (svtb)](/img/dc/a809f2ec5f9e85a02e68c88bdcdb5e.png)
[quick start of Digital IC Verification] 12. Introduction to SystemVerilog testbench (svtb)

Rainbond结合NeuVector实践容器安全管理

JS copy picture to clipboard read clipboard

Register of assembly language by Wang Shuang

Leetcode simple question: find the K beauty value of a number

Interpreting the practical application of maker thinking and mathematics curriculum

Myabtis_ Plus
随机推荐
The field value in Splunk subquery fuzzy matching CSV is*
IELTS review progress and method use [daily revision]
Zcmu--1396: queue problem (2)
Infix keyword infix expression and the use of generic extension function in kotlin
Transformation function map and flatmap in kotlin
Learn how to compile basic components of rainbow from the source code
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
Opencv learning notes 1 -- several methods of reading images
Obsidan之数学公式的输入
漏洞复现-Fastjson 反序列化
Xcit learning notes
Wang Zijian: is the NFT of Tencent magic core worth buying?
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
Pytoch (VI) -- model tuning tricks
Opencv learning note 4 - expansion / corrosion / open operation / close operation
Use of out covariance and in inversion in kotlin
Deit learning notes
grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器