UPDATE:
update 表名 set 列名1=value1,列名2=value2 ...
update a set a.name=b.name from STUDENTSas a inner join Class as b on a.StuId = b.ClassId update Class as C set(ClassName,ClassDesc)= (select (StuName,StuDesc) from STUDENTS as S where S.StuId=C.ClassId)
INSERT:
1、insert into 表名 values(value1,value2,value3...)
2、insert 表名 (列1,列2,列3) values(value1,value2,value3...)
insert into 和insert 的区别: insert into 表名 values(value1,value2,value3...)必须为表中的所有列赋值,即使列中的值可空
insert 表名 (列1,列2,列3) values(value1,value2,value3...)第一个括号中有几列,第二个括号就要填入几个数据
insert into select ……
insert into table2 (列1,列2,列3) select value1,value2 from table1 或者:insert into table2 select * from table1 【注意】:table1和table2的表结构要一致
insert 向多个关联表中批量插入数据:
DELETE:
delete from table ……可与where连用
delete 关联:delete a from table1 a inner join table2 b on a.ID=b.ID