|
發展速度由于采用基期的不同,可分為同比發展速度、環比發展速度和定基發展速度。均用百分數或倍數表示。
同比發展速度主要是為了消除季節變動的影響,用以說明本期發展水平與去年同期發展水平對比而達到的相對發展速度。如,本期2月比去年2月,本期6月比去年6月等。
???? 在實際工作中,經常使用這個指標,如某年、某季、某月與上年同期對比計算的發展速度,就是同比發展速度。
環比發展速度是報告期水平與前一時期水平之比,表明現象逐期的發展速度。如計算一年內各月與前一個月對比,即2月比1月,3月比2月,4月比3月 ……12月比11月,說明逐月的發展程度。如分析抗擊"非典"期間某些經濟現象的發展趨勢,環比比同比更說明問題。
???? 定基比發展速度也叫總速度。是報告期水平與某一固定時期水平之比,表明這種現象在較長時期內總的發展速度。如,"九五"期間各年水平都以1995年水平為基期進行對比,一年內各月水平均以上年12月水平為基期進行對比,就是定基發展速度。
問:你成功的秘訣是什么?
答:兩個詞。
問:是什么?
答:正確決策。
問:你如何做出正確的決策?
答:一個詞。
問:是什么?
答:經驗。
問:你如何獲取經驗?
答:兩個詞。
問:是什么?
1.? top N 問題
在sql server中,top N 問題很容易解決,如下例:從表stbdbdj中選取排序后的第一行數據進行賦值。
在sql中解決方法很簡單,在select 后面加上:top n 即可,其中 n 代表行數。
@entrust_no?=?entrust_no
from?run2k..stbdbdj
where?entrust_date?=?@date
and?entrust_no?>?@entrust_no_q
and?report_status?=?'1'
order?by?entrust_date,entrust_no;
在oracle中,沒有top n這個命令,我們采取把兩層查詢方式解決:首先,把需要查找的字段值直接進行排序,然后在外面進行第二次查詢,并使用rownum決定行數。
into?@entrust_date,?@entrust_no
from?(?select?entrust_date,entrust_no
from?stbdbdj
where?entrust_date?=?@date
and?entrust_no?>?@entrust_no_q
and?report_status?=?'1'
order?by?entrust_date,entrust_no?)
where?rownumber?<=1?;
2. 如何解決結果集返回時,* 和變量同時存在的問題
下面例子表示,在用游標返回結果集時,同時返回一個變量的值,在
sql server
中代碼如下所示:
from?run2k..stbbp?a,run2k..stkaccoarg?b
where?a.date?=?@entrust_date
and?a.serial_no?=?@serial_no
and?a.branch_no?=?b.branch_no
and?a.exchange_type?=?b.exchange_type;
但在oracle中卻沒有這種用法,’*’后面必需跟from。解決方法如下:
1)我們可以把 '*' 變成所需要選擇的字段,就是說采用表中需要顯示的全部字段表示*。
例如:
select
?branch_no,...,organ_id
where
...
2)如果這個字段或者說變量是從另外一張表中取出來的,同樣可以采用下面的辦法。
select?a.*,b.organ_id;
from?stkaccoentrust?a,?stkaccoarg?b
where?a.branch_no?=?b.branch_no
and?a.exchange_type?=?b.exchange_type
and?a.init_date?=?v_entrust_date
and?a.serial_no?=?v_serial_no;
3. 外聯接問題
sql
<--->
oracle
a = *b <---> a(+)= b
a *= b <---> a = b(+)
4. 多條記錄求和問題
select sum(A+B+C)
into D
from ...
where ...
group by ...
單條記錄求和
select A+B
into C
from ...
where ...
5. case 問題轉換
sql:
case client_status
when '0' then '正常'
when '1' then '凍結'
when '2' then '掛失'
when '3' then '銷戶'
else '未知'
end
oracle:
decode(client_status,'0','正常,'1','凍結','2','掛失','3','銷戶','未知');
6. char 和 varchar 類型區別:
char 尾部補空格,varchar 尾部不補空格。
7. convert轉換問題
sql
--->
oracle
convert(char(5),branch_no) ---> to_char(branch_no,'99999')
convert(char(19),count(*)) ---> lpad(to_char(count(*)),19)
convert(varchar(20),serial_no) ---> to_char(serial_no,'999...9' )
總共20個9
lpad(to_char(serial_no),20)
8. charindex(substring,string) ---> instr(string,substring)
子串 父串 ---> 父串 子串