案例來源: PTT
select col from tmp;
1
2
3
4
..
10
我要變成
00001
00002
00003
00004
....
00010

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
查看user下的表各種狀態
*****************************

to52016 發表在 痞客邦 留言(0) 人氣()

擷取1
 
oracle 分頁三步驟
1. rownum分頁
    (select * from emp);

to52016 發表在 痞客邦 留言(0) 人氣()

 

找出高於自己(id=108)部門平均工資的員工資訊
*************************************
select employee_id,first_name,salary from emp where salary>(
select avg(salary) from emp where department_id=(select department_id from emp where employee_id=108));

to52016 發表在 痞客邦 留言(0) 人氣()

1
 
 
基本上大量的資料都不會存在EXCEL中(只能存104萬筆),透過POWER PIVOT可與資料庫連接來製作樞紐分析
使用POWER PIVOT可以連線大型資料庫,匯入所需資料模型來處理巨量的資料,並建立樞紐分析表與樞紐分析圖。

to52016 發表在 痞客邦 留言(1) 人氣()

 
 
 
 

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
案例來源:ITPUB
表1:create table tst001 (a varchar2(100),b varchar2(100));
insert into tst001 values(1,'test001');
insert into tst001 values(1,'test002');
insert into tst001 values(1,'test003');
insert into tst001 values(1,'test004');

表2:
create table tst002 (a varchar2(100),b varchar2(100),c varchar2(100));
insert into tst002 values(1,'abc',1);
insert into tst002 values(1,'abcd',2);
insert into tst002 values(1,'abcde',3);
insert into tst002 values(1,'abcdef',4);


結果:

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
表里有这样的记录:
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 5 8
1 3 5 6 8 9

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
案例來源:ITPUB
 

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
1.可以在用戶環境變數中指定(LINUX)。
在用戶的.bash_profile中增加兩句:
export NLS_LANG=AMERICAN ---要注意這一句必須指定,不然下一句不生效。
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'

to52016 發表在 痞客邦 留言(0) 人氣()

 
select * from employees;
select * from departments;
select department_id,avg(salary) from employees group by department_id;

to52016 發表在 痞客邦 留言(0) 人氣()

 
 
總結:
无论是单列唯一索引或复合唯一索引,对于可以为null的列或复合null值,Oracle不会为其存储索引值。
    故在基于单列创建B树唯一索引或多列创建B树复合唯一索引的情形下,
    当列上允许为null值时
        where子句使用了基于is null的情形,其执行计划走全表扫描。
        where子句使用了基于is not null的情形,其执行计划走索引扫描(索引范围扫描或索引全扫描)。
    当列上不允许为null值时,存在非null约束
        where子句使用了基于is null的情行,其执行计划走索引扫描。
        where子句使用了基于is not null的情形,其执行计划也是走索引扫描。
    注:此在Oracle 10g R2(linux)下的情形,不同的优化器版本可能会有偏差

to52016 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。