1,開始以前先看張圖sql
A表和B表是數據有重複部分的表,如今若是想獲取A表中B表不存在的數據語句有兩種:oracle
①. 使用left join ;[假設倆張表中都有共同字段id]spa
select a.id,b.id from A a left join B b on a.id = b.id where b.id is null table
②. 使用not in ;test
select a.id,b.id from a where a.id not in (select b.id from B b)效率
綜合兩種的效率,第一種較快些,數據多的可選第一種,數據少就無所謂。date
2,操做數據的時候不免會遇到根據查詢到的表數據來操做其餘數據的需求,oracle知足了有根據sql語句直接建立表的須要。select
create table 表名 as 查詢語句sql語句
egg: create table student as select * from test where id >10im
3,若是說表中的某一列數據有特殊的符號,而這些符號你不想要,好的,oracle知足你。
update 表名 set 列名=replace(列名,符號);
egg: 來個更新的語句【假設student表的id數據包含符號 '-'】:
update student set id = replace ( id , '-' );
4,數據多了,不免數字的一列有空值【注意這裏的空值不是0】這時候若是把空值變爲0,oracle也幫你想到辦法啦。
update 表名 set 列名= nvl(列名,0);
egg: update student set money = nvl(money,0);
先這些吧,之後慢慢整理!