Dust Of Dream

          知識真的是一個圓么?

          Oracle SQL培訓(xùn)筆記[開發(fā)人員][二]

          三 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的查詢?yōu)閕s 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 閱讀(943) 評論(0)  編輯  收藏 所屬分類: 牧羊陣法

          My Links

          Blog Stats

          News

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          新聞檔案

          相冊

          常去網(wǎng)站

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 内江市| 调兵山市| 淮滨县| 成安县| 共和县| 邹城市| 五大连池市| 育儿| 南城县| 寻甸| 资兴市| 中阳县| 东阿县| 简阳市| 祁东县| 龙海市| 徐州市| 绥化市| 同仁县| 潞西市| 石门县| 铁力市| 彭阳县| 修水县| 西藏| 中山市| 藁城市| 舟曲县| 漳州市| 平乐县| 塔城市| 休宁县| 广州市| 鸡泽县| 厦门市| 德安县| 合山市| 大新县| 石渠县| 宜君县| 巴青县|