zoukankan      html  css  js  c++  java
  • 数据库完整性

    参照完整性

    references tb_name(index_col_name,...)

    [on delete reference option]

    [on update reference option]

    限制策略级联策略置空策略不采取实施策略

    restrict | cascade | set null | no action \默认策略是restrict

    定义与实现完整性约束

    use mysql_test;

    create table orders

    (

      order_id int not null auto_increment,

      order_product char(50) not null,

      order_product_type char(50) not null,  

      cust_id int not null,

      order_date datetime not null,

      order_price double not null,

      order_amount int not null.

      primary key(order_id),

      foreign key(cust_id)

      references cust(cust_id)

      on delete restrict

      on update restrict

    )

    用户定义的完整性: 非空约束,check约束

    命名完整性约束: constraint[symbol]  \只能给基于表的完整性约束指定名字,无法给基于列的完整性约束指定名字

    更新完整性约束: 使用alter table语句更新与列或表有关的各种约束

    1)完整性约束不能直接被修改(先删除,再增加).

    2)使用alter table语句,可以独立的删除完整性约束,而不会删除表本身(drop table语句删除一个表,则表中所有的完整性约束都会被自动删除).

  • 相关阅读:
    Undo/Redo的C#实现方式
    c#中@符号作用
    面向对象理解随笔
    C# 面向对象定义常量,属性,方法
    c# 字段和属性
    面向对象思想
    用C表达面向对象语言的机制——C#版
    判断生日
    查找字符
    被7整除
  • 原文地址:https://www.cnblogs.com/lsxsx/p/13393922.html
Copyright © 2011-2022 走看看