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

边栏推荐
- DeiT学习笔记
- Rainbow version 5.6 was released, adding a variety of installation methods and optimizing the topology operation experience
- Improve the delivery efficiency of enterprise products (1) -- one click installation and upgrade of enterprise applications
- One click installation of highly available Nacos clusters in rainbow
- Myabtis_ Plus
- Application of slip ring of shipborne radar antenna
- Avatary's livedriver trial experience
- Ebpf cilium practice (2) - underlying network observability
- OpenVSCode云端IDE加入Rainbond一体化开发体系
- MES system is a necessary choice for enterprise production
猜你喜欢

One click installation of highly available Nacos clusters in rainbow

Réplication de vulnérabilité - désrialisation fastjson

Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu

Ebpf cilium practice (1) - team based network isolation

rsync远程同步

opencv学习笔记四——膨胀/腐蚀/开运算/闭运算

Famine cloud service management script
![[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)

Opencv learning notes II - basic image operations

Rainbond 5.6 版本发布,增加多种安装方式,优化拓扑图操作体验
随机推荐
XCiT学习笔记
Qinglong panel - today's headlines
BiSeNet的特點
[quick start of Digital IC Verification] 11. Introduction to Verilog testbench (VTB)
Complete linear regression manually based on pytoch framework
[untitled]
JS copy picture to clipboard read clipboard
Domain specific language / DSL in kotlin
Interview questions (CAS)
Pvtv2--pyramid vision transformer V2 learning notes
[quick start of Digital IC Verification] 12. Introduction to SystemVerilog testbench (svtb)
The single value view in Splunk uses to replace numeric values with text
Réplication de vulnérabilité - désrialisation fastjson
SSM 整合
【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器
Qinglong panel -- Huahua reading
漏洞複現-Fastjson 反序列化
Lua programming learning notes
Vulnerability recurrence easy_ tornado
Uniapp mobile terminal forced update function