当前位置:网站首页>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
边栏推荐
- Réplication de vulnérabilité - désrialisation fastjson
- [step on the pit series] H5 cross domain problem of uniapp
- 饥荒云服管理脚本
- Lua 编程学习笔记
- Qinglong panel -- Huahua reading
- [quick start of Digital IC Verification] 13. SystemVerilog interface and program learning
- 【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器
- Analysis of maker education in innovative education system
- Using nocalhost to develop microservice application on rainbow
- Hisense TV starts the developer mode
猜你喜欢
漏洞複現-Fastjson 反序列化
一文了解如何源码编译Rainbond基础组件
Opencv learning notes II - basic image operations
Rsync remote synchronization
PVTV2--Pyramid Vision TransformerV2学习笔记
Splunk中single value视图使用将数值替换为文字
Wang Zijian: is the NFT of Tencent magic core worth buying?
Unityhub cracking & unity cracking
Learn how to compile basic components of rainbow from the source code
eBPF Cilium实战(1) - 基于团队的网络隔离
随机推荐
Open3D ISS关键点
Lua 编程学习笔记
XCiT学习笔记
Rainbond结合NeuVector实践容器安全管理
Give full play to the wide practicality of maker education space
Easy to understand SSO
Leetcode medium question my schedule I
Golang 编译约束/条件编译 ( // +build <tags> )
Automatic upgrading of database structure in rainbow
【雅思口语】安娜口语学习记录 Part2
Bisenet features
【雅思口语】安娜口语学习记录 Part3
opencv学习笔记一——读取图像的几种方法
提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
eBPF Cilium实战(1) - 基于团队的网络隔离
雅思考试自己的复习进度以及方法使用【日更版】
在 Rainbond 中一键安装高可用 Nacos 集群
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
Using helm to install rainbow in various kubernetes
Practice of implementing cloud native Devops based on rainbow library app