DML数据操纵语言

增加数据
insert into student values(1,"安琪拉",'女');
-- 批量新增
insert into student values(2,"米莱迪",'女'),(3,"嬴政",'男'),(4,"武则天",'女');

给指定的字段赋值

insert into 表名(字段名1,字段名2,…) values(值1,值2);

nsert into student(id,name) values(5,"达摩");

insert into student(id,name) values(6,"韩信"),(7,"李白");
给指定的字段赋值

insert into student set 字段名 =值,字段名= 值…;

insert into student set name="王安石";

insert into student set name="杜甫",sex='男';
修改数据 update

update 表名 set 字段名 =值,字段名= 值… [where 筛选];

如果不写筛选条件 修改所有数据

-- 修改满足要求的指定数据
update student set sex ='男' where id = 1;
-- 批量修改
update student set name='李白';
删除数据 delete

delete from 表名 [where 筛选条件];

不写筛选条件 删除所有

-- 删除符合要求的数据
delete from student where id = 3;

-- 批量删除

delete from student;
上一篇:DML语言


下一篇:Mysql第四篇【DML常见操作】