create index emp_deptno_index on emp(deptno)
pctfree 25
tablespace users;
create bitmap index emp_salary_bmp
on employees(salary)
tablespace users;
connect scott/1qaz2wsx
create index emp_job_reverse
on emp(job) reverse
tablespace users;
create index emp_job_fun
on emp(lower(job));
alter index emp_deptno_index
coalesce deallocate unused;
alter index emp_deptno_index rebuild;
 drop index emp_job_fun
connect system/1qaz2wsx
select index_name,index_type
from dba_indexes
where owner = 'HR';
column column_name for a30
select column_name ,column_length
from user_ind_columns
where index_name = 'EMP_DEPTNO_INDEX';
select tablespace_name,segment_type,bytes
from user_segments
where segment_name = 'EMP_DEPTNO_INDEX';
connect scott/1qaz2wsx
select column_expression
from user_ind_expressions
where index_name = 'EMP_JOB_FUN';
connect scott/1qaz2wsx
create or replace view emp_view as
select empno,ename,job,deptno
from emp
where deptno = 20;
create or replace view emp_view_readonly as
select * from dept
where deptno != 88
with read only;
create or replace view emp_view_complex as
select deptno 部门编号,max(sal) 最高工资,min(sal) 最低工资,avg(sal) 平均工资
from emp
group by deptno;
create or replace view emp_view_union as
select d.dname,d.loc,e.empno,e.ename
from emp e,dept d
where e.deptno = d.deptno and d.deptno = 20;
create public synonym public_dept for scott.dept;
create  synonym  private_dept for dept;
create sequence empno_seq
maxvalue 99999
start with 9000
increment by 100
cache 50;
alter sequence empno_seq
maxvalue 100000
increment by 200
cache 100
--创建表
create table tb_10_1(
stuno number(10) not null, --学号
stuname varchar2(8), --姓名
sex char(2), --性别
age int
); ---创建索引
create index tb_10_1_index on tb_10_1(sex)
pctfree 25
tablespace users;
--创建表
create table tb_10_2(
id number(10) not null, --编号
stuname varchar2(8), --姓名
sex char(2), --性别
age int
); --创建序列
create sequence id_seq
maxvalue 10000
start with 1
increment by 3
cache 50; --测试
insert into tb_10_2(id,stuname,sex,age)
values(id_seq.nextval,'东方','男',30);

吴裕雄--天生自然ORACLE数据库学习笔记:其它数据对象的更多相关文章

  1. 吴裕雄--天生自然ORACLE数据库学习笔记:数据导出与导入

    create directory dump_dir as 'd:\dump'; grant read,write on directory dump_dir to scott; --在cmd下 exp ...

  2. 吴裕雄--天生自然ORACLE数据库学习笔记:数据表对象

    create table students( stuno ) not null, --学号 stuname ), --姓名 sex ), --性别 age int, --年龄 departno ) n ...

  3. 吴裕雄--天生自然ORACLE数据库学习笔记:过程、函数、触发器和包

    create procedure pro_insertDept is begin ,'市场拓展部','JILIN'); --插入数据记录 commit; --提交数据 dbms_output.put_ ...

  4. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle数据备份与恢复

    run{ allocate channel ch_1 device type disk format = 'd:\oraclebf\%u_%c.bak'; backup tablespace syst ...

  5. 吴裕雄--天生自然ORACLE数据库学习笔记:PL/SQL编程

    set serveroutput on declare a ; b ; c number; begin c:=(a+b)/(a-b); dbms_output.put_line(c); excepti ...

  6. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle 11g的闪回技术

    alter system set db_recovery_file_dest_size=4g scope=both; connect system/1qaz2wsx as sysdba; archiv ...

  7. 吴裕雄--天生自然ORACLE数据库学习笔记:优化SQL语句

    create or replace procedure trun_table(table_deleted in varchar2) as --创建一个存储过程,传入一个表示表名称的参数,实现清空指定的 ...

  8. 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle系统调优

    --修改 alter system set large_pool_size=64m; --显示 show parameter large_pool_size; select sum(getmisses ...

  9. 吴裕雄--天生自然ORACLE数据库学习笔记:用户管理与权限分配

    create user mr identified by mrsoft default tablespace users temporary tablespace temp; create user ...

  10. 吴裕雄--天生自然ORACLE数据库学习笔记:表分区与索引分区

    create table ware_retail_part --创建一个描述商品零售的数据表 ( id integer primary key,--销售编号 retail_date date,--销售 ...

随机推荐

  1. Sublime Text3搭建完美开发环境(Python+PHP+Javascript+nodejs+C++)

    一.Sublime配置(如已安装Package Control可跳过) sublime下载地址:http://www.sublimetext.com/3 安装Package Control插件: 直接 ...

  2. .net core IIS 发布

    发布时注意事项: 1.本机安装.net core SDK 2.启动项目预加载 3.应用池配置为 无托管代码 4.设置应用池-->高级设置-->启动模式为:AlwaysRunning 5.在 ...

  3. Codeforces Round #579 (Div. 3) 题解

    比赛链接:https://codeforc.es/contest/1203/ A. Circle of Students 题意:\(T\)组询问,每组询问给出\(n\)个数字,问这\(n\)个数字能否 ...

  4. EditPlus 注册码在线生成

    虽然editplus现在不常用,但是它轻便,我还是很喜欢的,推荐一个注册码生成器,真是好好用 http://www.jb51.net/tools/editplus/ 点击链接输入自己想要的用户名,就能 ...

  5. JavaScript 对象属性与方法

    对象的创建: 1 字面量创建 var obj = {a:1,b:2}; 2 构造函数创建 var obj = new Object(); obj.a = 1; obj.b = 2; 3 Object. ...

  6. Oracle中trunc()函数用法

    SQL表达式 注释 SELECT SYSDATE FROM dual --当前系统时间,24小时制 SELECT TO_CHAR(SYSDATE,'yyyy-mm-dd hh24:mi:ss') FR ...

  7. Linux编程日常错误

    编译的时候出现如下错误提示: undefined reference to `sem_init'undefined reference to `sem_post'undefined reference ...

  8. 科技 - 5G

    科技 - 5G 一.5G的概念 第五代移动通信技术(英语:5th generation mobile networks或5th generation wireless systems.5th-Gene ...

  9. zookeeper 源码(一) 选举和同步数据

    前言 在开始阅读代码前我们先来了解一下zk 的大致结构,具体大概要实现的核心功能有那些,心中有个大概的框架阅读代码时再深入其中的细节,就会非常好懂,本人觉得这是一个阅读源码的好方法,可以最快地切入到源 ...

  10. HDU 1241 Oil Deposits(经典DFS)

    嗯... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1241 很经典的一道dfs,但是注意每次查到一个@之后,都要把它变成“ * ”,然后继续dfs ...