zoukankan      html  css  js  c++  java
  • Oracle创建表

    //创建表,列的内容

    -- Create table
    create table T_HQ_PC
    (
    pinpai VARCHAR2(20) not null,
    xingh VARCHAR2(40),
    jiage NUMBER,
    chuchangrq DATE,
    shifoutc CHAR(1)
    )
    tablespace TEST
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );

    //添加注释
    -- Add comments to the columns
    comment on column T_HQ_PC.pinpai
    is '电脑品牌';
    comment on column T_HQ_PC.xingh
    is '型号';
    comment on column T_HQ_PC.jiage
    is '价格';
    comment on column T_HQ_PC.chuchangrq
    is '出厂日期';
    comment on column T_HQ_PC.shifoutc
    is '是否停产:1-是;2-否';

    //创建主键约束
    -- Create/Recreate primary, unique and foreign key constraints
    alter table T_HQ_PC
    add constraint PK_T_HQ_PC primary key (PINPAI)
    using index
    tablespace TEST
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );

    //创建检查约束
    -- Create/Recreate check constraints
    alter table T_HQ_PC
    add constraint CHECK_JIAGE
    check (jiage > 1000.00 and jiage < 60000.00);
    alter table T_HQ_PC
    add constraint CHECK_SHIFOUTC
    check (shifoutc = '1' or shifoutc = '2');

  • 相关阅读:
    DS博客作业--线性表
    c博客06-2019-结构体&文件
    C语言博客作业03--函数
    DS博客作业05--查找
    DS博客作业04--图
    DS博客作业03--树
    DS博客作业02--栈和队列
    DS博客作业2--线性表
    c博客06-结构体&文件
    C语言博客作业—2019-指针
  • 原文地址:https://www.cnblogs.com/shadowduke/p/4909721.html
Copyright © 2011-2022 走看看