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

  • 相关阅读:
    经典网络命令(搜集、概括)
    浅谈“五万月薪涉足数据恢复行业”
    C语言宏定义技巧(常用宏定义)
    安装IIS5.0出错
    IDM(Internet Download Manager)下载
    tape记忆法
    华为手环更换绑定手机
    冯况 | 清理电脑磁盘
    利用知网查个人信息
    双向循环链表
  • 原文地址:https://www.cnblogs.com/jingfengling/p/5947909.html
Copyright © 2011-2022 走看看