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)

          隨筆分類

          隨筆檔案

          新聞檔案

          相冊

          常去網站

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 上蔡县| 吉木乃县| 奎屯市| 揭西县| 锦州市| 信丰县| 榆林市| 宜君县| 崇左市| 临颍县| 繁峙县| 红原县| 成都市| 社旗县| 象山县| 新竹县| 博白县| 闵行区| 武邑县| 赤壁市| 琼中| 太湖县| 安塞县| 汪清县| 平塘县| 江华| 莫力| 阿拉善盟| 古田县| 天等县| 三门峡市| 梧州市| 云阳县| 马山县| 郴州市| 鹤岗市| 房产| 南木林县| 信阳市| 乌兰浩特市| 绥滨县|