zoukankan      html  css  js  c++  java
  • 数据库用户的建立,表空间的建立,数据的编辑

    //表空间
    CREATE SMALLFILE TABLESPACE "ZUOYE" DATAFILE 'D:ORACLE11GORADATAORCLUOYE.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
    
    //表空间的空间修添加
    ALTER TABLESPACE "ZUOYE" ADD DATAFILE 'D:ORACLE11GORADATAORCLUOYE1.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
    
    //创建用户
    -- Create the user 
    create user zuoye            //用户名
      identified by "123654789"        //密码
      default tablespace ZUOYE        //表空间
      temporary tablespace TEMP;        //临时表空间
    -- Grant/Revoke role privileges 
    grant connect to zuoye;            //授予connect权限
    grant dba to zuoye;            //授予dba权限
    
    //列的内容
    -- Create table
    create table T_HQ_ZYl
    (
      "bianh"   number not null,
      "xingm"   varchar2(10) not null,
      "xingb"   number default 1 not null,
      "nianl"   number not null,
      "jiatzz"  varchar2(50),
      "xins"    number default 0 not null,
      "gongzsj" number not null
    )
    ;
    
    //注释
    -- Add comments to the columns 
    comment on column T_HQ_ZYl."bianh"
      is '编号';
    comment on column T_HQ_ZYl."xingm"
      is '姓名';
    comment on column T_HQ_ZYl."xingb"
      is '性别:男-1;女-2;';
    comment on column T_HQ_ZYl."nianl"
      is '年龄';
    comment on column T_HQ_ZYl."jiatzz"
      is '家庭住址';
    comment on column T_HQ_ZYl."xins"
      is '薪水';
    comment on column T_HQ_ZYl."gongzsj"
      is '工作时间';
    
    //检查,约束
    -- Create/Recreate check constraints 
    alter table T_HQ_ZY
      add constraint CHECK_BIANH
      check (bianh != bianh);
    alter table T_HQ_ZY
      add constraint CHECK_NIANL
      check (nianl>20 and nianl<50);
    alter table T_HQ_ZY
      add constraint CHECK_XINGB
      check (xingb = 1 or xingb = 2);

    创建用户前需要先创建表空间。

    创建表空间时注意将表空间文件的后缀名添加上!比如:biaokongjian.DBF 。    .DBF  就是需要注意的文件后缀

  • 相关阅读:
    数据库 封装类CppSQLite3的helloword VC6
    数据库 sqlite 进阶
    数据库 sqlite3_get_table,sqlite3_free_table
    数据库 sqlite3_open,sqlite3_exec,slite3_close
    数据库 SQLite C++ 接口
    数据库 如何在VC6下使用sqlite3
    MFC CButtonST使用技巧(一)(二)(三)
    MFC CButtonST简介
    MFC CButtonST 在你的程序中如何使用CButtonST类
    MFC静态分割后锁定分隔条/限制分隔条的移动范围 方法1
  • 原文地址:https://www.cnblogs.com/name-hanlin/p/4908925.html
Copyright © 2011-2022 走看看