插入:insert into 表名(key1,key2,...) values(value1,value2);
insert into 表名 values(value1,value2);
更新:update 表名称 set 列名称 = 新值 where 列名称 = 某值;
删除:delete from 表名 where 条件;
查表中的重复字段:select 重复记录字段名 form 数据表名 group by 重复记录字段名 having count(重复记录字段名)>1
给数据表添加字段:alter table 表名 add 字段名 nvarchar (50) null;
修改表字段长度:alter table 表名 modify(字段名 字段类型(长度));
数据表锁定后,解锁语句:
select session_id from v$locked_object; --784
select sid, serial#, username, osuser FROM v$session where sid = 784; --784,18225
alter system kill session '781,18225';
in操作符:select * from 表A where 字段cc in (select cc from 表B);
not in操作符:select * from 表A where 字段cc not in (select cc from 表B); --最好不用not in
二者等价:
select name from student where name in('zhang','wang','zhao');
select name from student where name='zhang' or name='wang' or name='zhao';
exists是对外表作loop循环,每次loop循环再对内表进行查询;not exists与之相反
select * from 表A where exists(select cc from 表B where cc=A.cc);
select * from 表A where not exists(select cc from 表B where cc=A.cc);
in、not in与exists、not exists的区别:https://blog.csdn.net/D_C_Hao/article/details/88529199