1.insert
语法:
insert into 表名(列名1,列名2,)values(值1,值2,);
语法2:一次性插入多条记录
insert into 表名(列名1,列名2,)values(值1,值2,),(值1,值2,);
示例:
insert into dept(deptno,dname,loc) values(50,'市场部','南京');
insert into dept(deptno,dname) values(60,'开发部');
insert into dept values(11,'aaa','aaa'),(22,'bbb','bbb');
2.delete
语法:
delete from 表名 where 条件;
示例:
删除部门编号为60的部门信息
delete from dept where deptno=60;
删除市场部所有员工工资高于5000的员工
delete from emp where deptno=
(
select deptno from dept where dname='市场部'
)
and sal>5000;
注意:delete from emp 会将emp表中的所有数据彻底删除
3.update
语法:
update 表名 set 列名1=值1,列名2=值2 where 条件;
示例:
update dept set dname='market' where dname='市场部';
update emp set job='manager',sal=8888,comm=666 where ename='smith';
标签:insert,dname,列名,更新,dept,MySQL,操作,where,into From: https://blog.csdn.net/2403_87863502/article/details/143777256