• 【考试】用户管理


    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');
  • 相关阅读:
    openstack生产要素
    None
    nginx优化 tbc
    zabbix开源监控解决方案
    HUGO & Hexo
    mysql数据库-运维合集
    Zabbix Agent ver5.0 批量部署
    CRI containerd
    zabbix聚合图形与Grafana图形展示
    zabbix 监控tomcat
  • 原文地址:https://www.cnblogs.com/tomatoes-/p/6087196.html
Copyright © 2020-2023  润新知