<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    kooyee ‘s blog

    開源軟件, 眾人努力的結晶, 全人類的共同財富
    posts - 103, comments - 55, trackbacks - 0, articles - 66
       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    [數據類型]NULL

    Posted on 2007-07-16 22:32 kooyee 閱讀(485) 評論(0)  編輯  收藏 所屬分類: Database數據庫技術

    在Database中"  "沒有值(空白)并不是等于NULL.
    空格也是一個值, 而不是NULL

    如果說給一個column賦值為空(不是空格,也不含空格), <null>

    set column = ''    //(單引號中間沒空格)

    而不是

    set column = NULL



    數據庫中, 當一個字段沒有任何資料時, 便是NULL  

    當你在處理由數據庫中所取出的 NULL 的資料時, 你必須要很注意, 因為NULL 所代表的是不合法的資料, 當某些函數在處理數學運算時,NULL 可能會制造一些麻煩, 你應先用 IsNull() 來判斷字段是否為NULL, 再做適當的處理,


    SELECT *
    FROM test
    WHERE test1 IS NULL;

    NOTE: Null In Oracle is an absence of information. A null can be assigned but it can not be equated with anything: Even itself.

    While this behavior is ANSI compliant it is not similar to the behavior in many other commercial RDBMS products.
    A simple SELECT statement to use for demonstrating the properties of NULL SELECT COUNT(*)
    FROM all_tables
    WHERE 1 = 1;
    A NULL is not equal to a NULL SELECT COUNT(*)
    FROM all_tables
    WHERE NULL = NULL;
    A NULL cannot be not equal to a NULL SELECT COUNT(*)
    FROM all_tables
    WHERE NULL <> NULL;
    A NULL is does not equal an empty string SELECT COUNT(*)
    FROM all_tables
    WHERE NULL = '';
    A NULL can  be used in an INSERT CREATE TABLE test (
    test1   NUMBER(10),
    test2   VARCHAR2(20));

    INSERT INTO test
    (test1, test2)
    VALUES
    (1, NULL);

    INSERT INTO test
    (test1, test2)
    VALUES
    (NULL, 'A');

    SELECT *
    FROM test;
     
    NOTE: Null is a state of being that can be interrogated as to whether it does or does not exist.
    A simple SELECT based on a column with a NULL SELECT *
    FROM test
    WHERE test1 IS NULL;

    SELECT *
    FROM test
    WHERE test1 IS NOT NULL
    A NULL can be used in an UPDATE UPDATE test
    SET test1 = '2'
    WHERE test2 IS NULL;

    SELECT *
    FROM test;

    UPDATE test
    SET test2 = 'B'
    WHERE test2 IS NOT NULL;

    SELECT *
    FROM test;
    A column can be updated to not contain a value UPDATE test
    SET test1 = NULL
    WHERE ROWNUM = 1;

    SELECT *
    FROM test;
    NULL can be used as part of the WHERE clause criteria in a DELETE Statement DELETE FROM test
    WHERE test1 IS NULL;

    SELECT *
    FROM test;

    Understand the implications of NULL
    CREATE TABLE t (
    col1 NUMBER(3),
    col2 NUMBER(3),
    col3 NUMBER(3));

    desc t

    INSERT INTO t
    (col1, col2, col3)
    VALUES
    (1, NULL, NULL);

    INSERT INTO t
    (col1, col2, col3)
    VALUES
    (NULL, 2, NULL);

    INSERT INTO t
    (col1, col2, col3)
    VALUES
    (NULL, NULL, 3);

    INSERT INTO t
    (col1, col2, col3)
    VALUES
    (4, 4, 4);

    COMMIT;

    SELECT *
    FROM t;

    SELECT SUM(RESULT_TMP) RESULT
    FROM (
      SELECT col1 - (col2 + col3) RESULT_TMP 
      FROM t);

    SELECT SUM(col1) - (SUM(col2) + SUM(col3)) RESULT
    FROM t;

    Note: For any row that has one of the values null, the entire row sums to null and is not included in the second query but the other columns in the row contribute to the sums in the query. So the first query includes more terms than the second.
    http://www.psoug.org/reference/null.html
    主站蜘蛛池模板: 日本特黄a级高清免费大片| 四虎在线视频免费观看视频| 国产做床爱无遮挡免费视频| 97久久国产亚洲精品超碰热| 国产一卡2卡3卡4卡2021免费观看| 亚洲香蕉免费有线视频| 在线视频免费国产成人| 日韩亚洲国产高清免费视频| 午夜毛片不卡免费观看视频| 亚洲乱妇熟女爽到高潮的片| 香蕉视频在线观看免费国产婷婷 | 日韩毛片免费一二三| 国产免费卡一卡三卡乱码| 理论秋霞在线看免费| 国产亚洲美女精品久久久2020| a级毛片免费全部播放无码| 亚洲AV永久青草无码精品| 91久久精品国产免费一区| 2020国产精品亚洲综合网| 国产精品无码一区二区三区免费 | 男女作爱在线播放免费网站| 亚洲AV日韩AV永久无码免下载| 91精品国产免费久久国语蜜臀| 亚洲国产成人久久三区| 国产美女无遮挡免费视频网站| 一区二区三区精品高清视频免费在线播放| 国产亚洲精品激情都市| 久久精品人成免费| 亚洲国产成人AV在线播放| 狠狠亚洲狠狠欧洲2019| 最新黄色免费网站| www亚洲精品久久久乳| 亚洲日韩欧洲乱码AV夜夜摸 | 国产不卡免费视频| 中文字幕av无码不卡免费| 亚洲欧洲国产综合| 四虎免费久久影院| 99视频免费播放| 美女裸免费观看网站| 亚洲视频在线免费观看| 又大又粗又爽a级毛片免费看|