zoukankan      html  css  js  c++  java
  • 【考试】用户管理

    1)创建一个用户名称为user1并授予权限至少能够访问hr.employees(不能授予dba权限)
    SYS@ORA11GR2>create user user1 identified by user1;
    
    User created.
    SYS@ORA11GR2>grant create session,create table,create sequence,create view to user1;
    
    2)用user1用户创建表students(学号 数值类型 主键约束stud_sno_pk,班级 字符类型外键参照班级表的班级列,姓名 字符类型 非空);
    USER1@ORA11GR2>create table students
      2  (sno number constraint stud_sno_pk primary key,
      3  scno number(20),
      4  sname varchar2(20),
      5  constraint stud_scl_fk foreign key (scno) references classes (cno));
    
    Table created.
    
    3)用user1用户创建表classes(班级 数值类型 主键约束);
    USER1@ORA11GR2>create table classes
      2  (cno number(5) constraint pk_cno primary key using index);
    
    Table created.
    4)模拟向以上两个表中插入数据,并且在数据字典中查询两个表的约束信息并显示。
    USER1@ORA11GR2>insert into classes values(01);
    
    1 row created.
    
    USER1@ORA11GR2>insert into classes values(02);
    
    1 row created.
    
    USER1@ORA11GR2>insert into students values(1,01,'zhangsan');
    
    1 row created.
    
    USER1@ORA11GR2>insert into students values(2,02,'lisi');
    
    1 row created.
    
    USER1@ORA11GR2>select constraint_name,constraint_type,table_name
      2  from user_constraints
      3  where table_name=upper('students');
    USER1@ORA11GR2>select constraint_name,constraint_type,table_name
      2  from user_constraints
      3  where table_name=upper('classes');
  • 相关阅读:
    CSS之Position详解
    线性回归预测法linear regression
    置信区间
    asp.net MVC 中使用dataannotation验证Model
    决策树Decision Tree
    Net反射在项目中的应用
    C#并行编程并行任务
    一个特殊的产品价格制定法(市场决定价格)
    Json
    线性规划模型(线性优化模型)Linear programming
  • 原文地址:https://www.cnblogs.com/tomatoes-/p/6087196.html
Copyright © 2011-2022 走看看