• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Prayer

            在一般中尋求卓越
            posts - 1256, comments - 190, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            外鍵 刪除

            Posted on 2010-05-09 18:15 Prayer 閱讀(231) 評論(0)  編輯 收藏 引用 所屬分類: DB2
            DELETE Rules
            When you delete a row from a parent table, the database manager checks if there
            are any dependent rows in the dependent table with matching foreign key values. If
            any dependent rows are found, several actions can be taken. You determine which
            action will be taken by specifying a delete rule when you create the dependent
            table.

            RESTRICT — This rule prevents any row in the parent table from being deleted if
            any dependent rows are found. If you need to remove both parent and dependent
            rows, delete dependent rows first.
            • NO ACTION — This rule enforces the presence of a parent row for every child
            after all the referential constraints are applied. This is the default. The difference
            between NO ACTION and RESTRICT is based on when the constraint is enforced.
            See the DB2 SQL Reference for further details.
            • CASCADE DELETE — This rule implies that deleting a row in the parent table
            automatically deletes any related rows in the dependent table.
            • SET NULL — This rule ensures that deletion of a row in the parent table sets the
            values of the foreign key in any dependent row to null (if nullable). Other parts
            of the row are unchanged.


            UPDATE Rules
            The database manager prevents the update of a unique key of a parent row. When
            you update a foreign key in a dependent table and the foreign key is defined with
            NOT NULL option, it must match some value of the parent key of the parent table.
            Two options exist:
            • RESTRICT — The update for the parent key will be rejected if a row in the
            dependent table matches the original values of the key.
            • NO ACTION — The update operation for the parent key will be rejected if any row
            in the dependent table does not have a corresponding parent key when the
            update statement is completed (excluding after triggers). This is the default


            在更新父表中的鍵值時,可以指定兩條規則:RESTRICT 和 NO ACTION。如果從屬表中有從屬行,則 RESTRICT 不允許更新鍵值。如果在更新完成時在從屬表中有從屬行,而從屬行在父表中沒有父鍵,則 NO ACTION 將導致對父鍵值的更新操作被拒絕

            RESTRICT 是在更新之前限制,
            NO ACTION 是在更新之后限制,
            結果一樣,判斷的時間點不同

            簡單地說 On delete no action 和 ON DELETE RESTRICT 的區別不大,ON DELETE RESTRICT 要比 On delete no action 的檢查條件嚴格些
            書上抄來的解釋(注意,解釋幾乎完全相同,唯一區別在于檢查鍵關聯的時間一個是 after,一個是 before):

            ON DELETE NO ACTION. This definition ensures that whenever a delete operation is performed on the parent table of a referential constraint, the value for the foreign key of each row in the child table will have a matching value in the parent key of the parent table (after all other referential constraints have been applied).


            ON DELETE RESTRICT. This definition ensures that whenever a delete operation is performed on the parent table of a referential constraint, the value for the foreign key of each row in the child table will have a matching value in the parent key of the parent table (before any other referential constraints are applied).

            伊人久久大香线蕉综合Av| 久久久www免费人成精品| 色综合久久中文综合网| 久久人妻少妇嫩草AV无码蜜桃| 国产69精品久久久久观看软件| 亚洲伊人久久大香线蕉苏妲己| 亚洲国产精品无码久久98| 久久久久国产精品麻豆AR影院| 国产精品久久99| 成人国内精品久久久久影院| 久久久久亚洲精品无码网址 | 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 精品国产乱码久久久久软件| 99久久无色码中文字幕| 中文字幕久久亚洲一区| 久久婷婷色综合一区二区| 99久久精品国内| 亚洲精品高清国产一线久久| 久久伊人五月天论坛| 久久中文娱乐网| 精品久久久久久成人AV| 69国产成人综合久久精品| 久久精品中文字幕大胸| 亚洲国产精品一区二区久久hs| 久久综合久久久| 久久99国产乱子伦精品免费| 一本久久知道综合久久| 亚洲精品无码专区久久久 | 久久婷婷国产综合精品| 久久久久高潮毛片免费全部播放| 国产毛片欧美毛片久久久| 国产精品免费久久久久电影网| 色综合久久精品中文字幕首页| 亚洲AV无码1区2区久久| 久久伊人五月丁香狠狠色| 日本欧美国产精品第一页久久| 久久AⅤ人妻少妇嫩草影院| 欧美精品丝袜久久久中文字幕| 国产精品美女久久久网AV| 99久久精品无码一区二区毛片 | 日韩亚洲国产综合久久久|