zoukankan      html  css  js  c++  java
  • 新建一个表

    创建表空间

    CREATE SMALLFILE TABLESPACE "ZUOYE" DATAFILE 'F:ORACLEPRODUCT10.2.0ORADATAORCLUOYE' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

     

     

     创建用户

    -- Create the user

    create user ZUOYE

      default tablespace ZUOYE

      identified by ZUOYE;

      temporary tablespace TEMP

      profile DEFAULT;

    -- Grant/Revoke role privileges

    grant connect to ZUOYE;

    grant dba to ZUOYE;

     

     创建表格

    -- Create table

    create table T_HQ_BJCY

    (

      xueh   NUMBER not null,

      xingm  VARCHAR2(10),

      xingb  NUMBER,

      sheng  NUMBER,

      jiatzz VARCHAR2(100)

    )

    tablespace ZUOYE

      pctfree 10

      initrans 1

      maxtrans 255

      storage

      (

        initial 64K

        minextents 1

        maxextents unlimited

      );

    -- Add comments to the columns

    comment on column T_HQ_BJCY.xueh

      is '学号;

    comment on column T_HQ_BJCY.xingm

      is '姓名;

    comment on column T_HQ_BJCY.xingb

      is '1-男,-女;

    comment on column T_HQ_BJCY.sheng

      is '身高;

    comment on column T_HQ_BJCY.jiatzz

      is '家庭住址;

    -- Create/Recreate primary, unique and foreign key constraints

    alter table T_HQ_BJCY

      add constraint PK_T_HQ_XUEH primary key (XUEH)

      using index

      tablespace ZUOYE

      pctfree 10

      initrans 2

      maxtrans 255

      storage

      (

        initial 64K

        minextents 1

        maxextents unlimited

      );

    -- Create/Recreate check constraints

    alter table T_HQ_BJCY

      add constraint CHECK_SHENG

      check (sheng > '140' and sheng < '220');

    alter table T_HQ_BJCY

      add constraint CHECK_XINGB

      check (xingb = '1' or xingb = '2');

     

     

     

  • 相关阅读:
    Hadoop杂记
    hadoop主节点(NameNode)备份策略以及恢复方法
    (转)第12章 Shell脚本编程
    Hadoop添加删除节点
    secondarynamenode异常
    (转)Memcached笔记——(一)安装&常规错误&监控
    浅(kou)谈(hu)杜教筛
    Pollard_Rho 算法
    Miller_Rabin 素数判定算法
    zoj分类(包括poj已做的)
  • 原文地址:https://www.cnblogs.com/chenning/p/4910194.html
Copyright © 2011-2022 走看看