其他分享
首页 > 其他分享> > DML数据操纵语言

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;

标签:insert,set,语言,into,DML,操纵,student,字段名,name
来源: https://blog.csdn.net/m0_56644341/article/details/116502954