学习参考https://www.bilibili.com/video/BV1Kr4y1i7ru?spm_id_from=333.999.0.0
目录
SQL分类
DML-数据操作
一. DML-添加数据
1.给指定字段添加数据
insert into employee(id,workno,name,gender,age,idcard,enday)
values(1,'1','text','男',10,'123456789012345678','2002-01-01');
2.给全部字段添加数据
insert into employee value(2,'2','text','男',19,'123456789012345678','2012-01-01');
3.批量添加数据
insert into employee value
(3,'3','text','男',19,'123456789012345678','2012-01-01'),
(4,'4','text','男',19,'123456789012345678','2012-01-01');
注意:
二,DML-更新和删除
1.修改数据
(1)单个字段
update employee set name = '你爹' where id = 1;
(2)多个字段
update employee set name = '鸡哥',gender = '女' where id = 1;
(3)修改整个字段
update employee set enday = '2000-10-10';
2.删除数据
delete from employee where gender = '女';
delete from employee