回覆列表
  • 1 # lanfengz2

    CREATE TABLE A001(ID INT PRIMARY KEY,NAME VARCHAR(20))

    CREATE TABLE A002(ID INT REFERENCES A001(ID)ON DELETE CASCADE ON UPDATE CASCADE,AGE TINYINT)

    CREATE TABLE A001(ID INT PRIMAY KEY,NAME VARCHAR2(20))

    CREATE TABLE A002(ID INT REFERENCES A001(ID)ON DELETE CASCADE,AGE NUMBER(2,0))

    --------------

    CREATE TABLE groups

    (

    id VARCHAR2(16) CONSTRAINT pk_groupid PRIMARY KEY,

    name VARCHAR2(32),

    description VARCHAR2(50)

    )

    TABLESPACE userspace;

    CREATE TABLE usringrp

    (

    group_id VARCHAR2(16) CONSTRAINT fk_uing_grpid

    REFERENCES groups(id)

    ON DELETE CASCADE,

    user_id VARCHAR2(16)

    )

    TABLESPACE userspace;

    ---------------

    PowerDesigner

    參照完整性約束

    限制(Restrict)。

    注意:在oracle中建立好的constraint (包括primay key,foreign key) 如果要修改,必須先alter table drop contraint con_name;然後再重新add constraint!。

  • 中秋節和大豐收的關聯?
  • 孕婦在孕期能不能吃黃桃?