Oracle 高级查询

1. 随机返回 5 条记录 
Select * from (select ename,job from emp order by dbms_random.value()) where rownum<=5 
 
 
2、处理空值排序 
select * from emp order by comm desc nulls last(first); 
 
 
3、查询跳过表中的偶数行 
select ename from (select row_number() over (order by ename) rn,ename 
from emp) x where mod(rn,2)=1; 
 
 
4.查询某用户下所有表 
select table_name from all_tables where owner='SCOTT'; 
 
 
5、查询 EMP 表中所有字段(列) 
select * from all_tab_columns where table_name='EMP'; 
 
 
6、列出表的索引列 
select * from sys.all_ind_columns where table_name='EMP'; 
select * from sys.all_ind_columns where 
upper(table_name)='CAREUSERHAM'; 
 
7、列出表中约束 
select * from all_constraints where table_name='EMP' 
 
8、在 oracle中描述数据字典视图 
select table_name ,comments from dictionary where table_name like '%TABLE%'; 

你可能感兴趣的:(Oracle,oracle,table,constraints,dictionary,comments)