Dust Of Dream

          知識真的是一個圓么?

          Oracle SQL培訓筆記[開發人員][二]

          三 null的那些事

          1. 在order 中,簡單把null認為是最大
          2. 與null的運算,返回null
            SQL> select 1 + null from dual;

                
            1+NULL
            ----------
          3. 與null的字符串合并,忽略null
            SQL> select 'Hi'||null from dual;

            'HI'||NULL
            ----------
            Hi
          4. Null的查詢為is null
          5. Count(field),不包括null
          6. 如果索引條目全為null,則索引不記錄null
          7. In/not in與null
          8. Exists/not exists與null
            SQL> select * from t1;

            A          B
            ---------- ----------
            1          1
            2          
            3          

            SQL
            > select * from t2;

            A          B
            ---------- ----------
            1          1
            2          

            SQL
            > select * from t1 where b in (select B from t2);

            A          B
            ---------- ----------
            1          1

            SQL
            > select * from t1 where b not in (select B from t2);

            A          B
            ---------- ----------

            SQL
            > select * from t1 where exists (select * from t2 where t2.b = t1.b);

            A          B
            ---------- ----------
            1          1

            SQL
            > select * from t1 where not exists (select * from t2 where t2.b = t1.b);

            A          B
            ---------- ----------
            3          
            2          

            exists主要用于片面的,有滿足一個條件的即可,  所以速度快很多.    in   主要用于具體的集合操作,   有多少滿足條件.

          posted on 2007-10-01 12:25 Anemone 閱讀(936) 評論(0)  編輯  收藏 所屬分類: 牧羊陣法

          My Links

          Blog Stats

          News

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          新聞檔案

          相冊

          常去網站

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 普定县| 南木林县| 抚远县| 安远县| 苏尼特右旗| 宽甸| 紫云| 礼泉县| 玛纳斯县| 丹凤县| 霞浦县| 依兰县| 化德县| 昭觉县| 南丰县| 乌拉特中旗| 颍上县| 宜川县| 安仁县| 甘谷县| 赤城县| 阳西县| 青田县| 昌图县| 云林县| 乌拉特后旗| 湖北省| 板桥市| 商丘市| 伽师县| 杭锦后旗| 美姑县| 昌平区| 宁陵县| 海阳市| 当阳市| 罗平县| 册亨县| 平乐县| 公主岭市| 华安县|