🌈个人主页: Aileen_0v0
🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法
💫个人格言:“没有罗马,那就自己创造罗马~”
SQL
DML
- DML (Data Manipulation Language):数据操作语言,用来对数据库中表的数据记录进行增删改操作。
- 添加数据(INSRT)
- 修改数据(UPDATE)
- 删除数据(DELETE)
DML-添加数据
INSERT INTO表名(字段名1,字段名2,...)VALUES(值1,值2,...); |
insert into employee(id, workno, name, gender, age, idcard, entrydate) values (1,'1','Itcast','女',10,'123456789101111111','2003-01-01');
select * from employee;
INSERT INTO表名VALUES(值1,值2,...); |
insert into employee(id, workno, name, gender, age, idcard, entrydate) values (1,'1','Itcast','女',10,'123456789101111111','2003-01-01');
select * from employee;
insert into employee values (2,'2','ling','男',22,'123456789102222222','2024-1-27');
INSERT INTO表名(字段1,字段2,...)VALUES(值1,值2,...),(值1,值2,...),(值1,值2,...); |
INSERT INTO表名VALUES(值1,值2,...),(值1,值2,...),(值1,值2,...); |
insert into employee values (3,'3','lin','男',33,'123456789106666666','2012-09-09');
注意事项
DML-修改数据
UPDATE 表名 SET 字段名1 = 值1,字段名2 = 值2,......[WHERE 条件]; |
注意事项
EXERCISES
update employee set name = 'itAileen' where id = 1;
update employee set name = '小玲',gender = '女' where id = 1;
update employee set entrydate = '2008-01-01';
DML-删除数据
DELETE FROM 表名[WHERE 条件]; |
注意事项
EXERCISES
delete from employee where gender = '女';
delete from employee;
总结: