zoukankan      html  css  js  c++  java
  • 数据库-代码建表

    -- Create table
    create table COURSE
    (
    cno VARCHAR2(10) not null,          列名  数据类型  是否可为空
    cname VARCHAR2(20) not null,          列名  数据类型  是否可为空
    tno VARCHAR2(6) not null          列名  数据类型  是否可为空
    )
    tablespace USERS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );
    -- Add comments to the columns           添加注释
    comment on column COURSE.cno          在cno列中添加注释
    is '课程号(主键)';                   注释为  ‘XXX’
    comment on column COURSE.cname
    is '课程名称';
    comment on column COURSE.tno
    is '教工编号(外键)';


    -- Create/Recreate primary, unique and foreign key constraints
    alter table COURSE
    add constraint C_COUNRSE primary key (CNO)          添加cno为主键
    using index
    tablespace USERS
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );
    alter table COURSE
    add constraint C_TNO foreign key (TNO)          添加 tno 为外键
    references TEACHER (TNO);                外键关联 teacher  表中的 tno

  • 相关阅读:
    Cookie的作用范围、设置、创建、获取的方法
    2020寒假总结14
    MyBatis中foreach传入参数为数组
    Springmvc接收数组参数
    寒假每日总结十
    2020寒假每日总结
    2020寒假总结八
    2020寒假每日总结七
    2020寒假每日总结四
    2020寒假总结三
  • 原文地址:https://www.cnblogs.com/jingfengling/p/5947909.html
Copyright © 2011-2022 走看看