mysql和oracle 开源_MySQL和oracle比较
1、判斷字符串為空串
--Mysql:在MySQL中,空值(Null)與空字符(’’)是不相同的
select '' is null;
+------------+
| '' is null |
+------------+
| 0 |
+------------+
select trim(' ')='';
+--------------+
| trim(' ')='' |
+--------------+
| 1 |
+--------------+
--所以在mysql中可以這樣來判斷空串
select *
from table
where trim(col) = '';
--***************************
--而在oracle,則空值(Null)與空字符(’’)是一樣的
select *
from table
where trim(col) is null;
2、虛表dual,oracle和mysql均存在該虛表,但對于下面語句:
select * from dual;
-- mysql執行會報錯
--oracle執行會查出如下:
D
-
X
3、關聯表進行刪除
-- mysql
delete a from hs_sett.fusettleholdsinfo a, hs_sett.fusettarg b
where a.exchange_type = b.exchange_type
and b.exchange_type = 'F1';
--oracle
delete from hs_futuvip.fusettleholdsinfo a
where exists(select 1
from hs_futuvip.fusettarg b
where a.futu_exch_type = b.futu_exch_type
and b.futu_exch_type = 'F1');
4、關聯表更新
-- mysql
update futransfertotal a, fusettarg b
set a.clear_balance=0,a.active_flag='1'
where a.exchange_type = b.exchange_type
and b.asset_kind = '1';
-- oralce
update futransfertotal a
set a.clear_balance=0,a.active_flag='1'
where exists(select 1
from fusettarg b
where a.futu_exch_type = b.futu_exch_type
and b.futu_exch_type = 'F1')
總結
以上是生活随笔為你收集整理的mysql和oracle 开源_MySQL和oracle比较的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Matlab画图技巧之消除空白(二)
- 下一篇: 如何判断是linux/windows库,