当前位置:网站首页>Basic operations of MySQL data table, addition, deletion and modification & DML
Basic operations of MySQL data table, addition, deletion and modification & DML
2022-07-05 12:12:00 【ziyi813】
MySql Basic operation -DML
DML explain
DML It refers to the data operation language , The full English name is (Data Manipulation Language), Used to add data records of tables in the database 、 Delete 、 modify .
keyword :
- insert Insert
- update to update
- delete Delete
Insert data into insert
Grammar format :
insert into surface ( Column 1, Column 2, Column 3, …) values ( value 1, value 2, value 3, …); // Insert values... Into the table , Must match type
insert into surface values ( value 1, value 2, value 3, …); // Insert values for all columns
Example :
insert into student (sid, name, gender, age, birth, address) values (1, ‘oscar’, ‘man’, 18, ‘2010-12-12’, ‘ Longgang District, Shenzhen ’);
Data update update
Grammar format :
update Table name set Field name = value , Field name = value
Example :
# There are no conditions , Then all addresses of the whole table will be changed to Shenzhen
update student set address = ' Shenzhen '
# With query criteria , Only specified conditions take effect
update student set address = ' Shenzhen ' where id = 1
# You can update the values of multiple fields at the same time , Separated by commas
update student set address = ' Shenzhen ', name = 'litchi' where id = 1
Data deletion delete
Grammar format
delete form Table name [where Conditions ]
truncate table Table name perhaps truncate Table name
Example :
-- Delete sid by 1 The data of
delete form student where sid = 1
-- Delete all data from the table
delete from student;
-- Empty data
truncate table student;
truncate student;
delete Is to delete all data in the table , and truncate Is equivalent to deleting the table and then rebuilding the table data structure , More thorough .
summary
DML Data manipulation language , Mainly aimed at MySql Add, delete and change
Three basic operations :
insert
delete
update
边栏推荐
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- 2022年国内云管平台厂商哪家好?为什么?
- 【load dataset】
- Course design of compilation principle --- formula calculator (a simple calculator with interface developed based on QT)
- 只是巧合?苹果 iOS16 的神秘技术竟然与中国企业 5 年前产品一致!
- Simply solve the problem that the node in the redis cluster cannot read data (error) moved
- Troubleshooting of high memory usage of redis in a production environment
- Video networkState 属性
- Is investment and finance suitable for girls? What financial products can girls buy?
- Yolov5 target detection neural network -- calculation principle of loss function
猜你喜欢
How to clear floating?
你做自动化测试为什么总是失败?
Matlab imoverlay function (burn binary mask into two-dimensional image)
liunx禁ping 详解traceroute的不同用法
Pytorch weight decay and dropout
1 plug-in to handle advertisements in web pages
Network five whip
Splunk configuration 163 mailbox alarm
MySQL splits strings for conditional queries
pytorch-softmax回归
随机推荐
What is digital existence? Digital transformation starts with digital existence
Time tools
Image hyperspectral experiment: srcnn/fsrcnn
Want to ask, how to choose a securities firm? Is it safe to open an account online?
Acid transaction theory
Semantic segmentation experiment: UNET network /msrc2 dataset
July Huaqing learning-1
Embedded software architecture design - message interaction
手机 CPU 架构类型了解
Redis cluster (master-slave) brain crack and solution
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
Reading notes of growth hacker
How to clear floating?
POJ-2499 Binary Tree
[configuration method of win11 multi-user simultaneous login remote desktop]
[calculation of loss in yolov3]
【PyTorch预训练模型修改、增删特定层】
《增长黑客》阅读笔记
强化学习-学习笔记3 | 策略学习
1个插件搞定网页中的广告