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');

     

     

     

  • 相关阅读:
    C++笔记(2018/2/6)
    2017级面向对象程序设计寒假作业1
    谁是你的潜在朋友
    A1095 Cars on Campus (30)(30 分)
    A1083 List Grades (25)(25 分)
    A1075 PAT Judge (25)(25 分)
    A1012 The Best Rank (25)(25 分)
    1009 说反话 (20)(20 分)
    A1055 The World's Richest(25 分)
    A1025 PAT Ranking (25)(25 分)
  • 原文地址:https://www.cnblogs.com/chenning/p/4910194.html
Copyright © 2011-2022 走看看