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

  • 相关阅读:
    设计模式(二十)---迭代器模式
    设计模式(十九)---观察者模式
    设计模式(十八)---模板方法模式
    设计模式(十七)---策略模式
    ElasticSearch 安装
    MongoDB进击 Linux单机安装
    List集合去除重复对象。。。记录一下
    Springboot整合mybatisPlus实现分页
    git记录
    Springboot异常处理errorController
  • 原文地址:https://www.cnblogs.com/jingfengling/p/5947909.html
Copyright © 2011-2022 走看看