create table NEED --用料需求表
站在用戶的角度思考問題,與客戶深入溝通,找到延安網(wǎng)站設(shè)計(jì)與延安網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名注冊(cè)、網(wǎng)絡(luò)空間、企業(yè)郵箱。業(yè)務(wù)覆蓋延安地區(qū)。
(
goodsno VARCHAR2(100),
prono VARCHAR2(100),
needqty NUMBER,
needbatch NUMBER
);
create table REQ --備料申請(qǐng)表
(
goodsno VARCHAR2(100),
prono VARCHAR2(100),
reqqty NUMBER
);
with t as
(select a.needbatch,
a.prono,
a.goodsno,
a.needqty,
b.reqqty - sum(a.needqty) over(order by a.prono, a.goodsno, a.needbatch) diffqty
from need a,
req b
where a.goodsno = b.goodsno
and a.prono = b.prono)
select t.needbatch,
t.prono,
t.goodsno,
t.needqty,
case
when t.diffqty = 0 then
t.needqty
else
case
when t.needqty + t.diffqty 0 then
t.needqty + t.diffqty
else
end
end qty
from t
1、查看所有表空間及表空間大?。?/p>
select tablespace_name ,sum(bytes) / 1024 / 1024 as MB from dba_data_files group by tablespace_name;
2、查看所有表空間對(duì)應(yīng)的數(shù)據(jù)文件:
select tablespace_name,file_name from dba_data_files;
3、修改數(shù)據(jù)文件大小:
alter database datafile 'H:\ORACLE\PRODUCT\10.1.0\ORADATA\ORACLE\USERS01.DBF' RESIZE 10240M;
1、創(chuàng)建測(cè)試表,
create table test_cols(id varchar2(20),remark varchar2(20),ex_filed1 varchar2(20),ex_filed2 varchar2(20));
2、編寫sql,查看系統(tǒng)視圖,可以看到該用戶下所有表的字段信息,select * from user_tab_cols;
3、編寫sql,查詢剛創(chuàng)建的表,字段信息,select * from user_tab_cols t where table_name = 'TEST_COLS';
4、編寫sql,查詢?cè)摫淼淖侄螖?shù),這樣對(duì)于字段較多的表,結(jié)果更明顯;
select count(distinct column_name) from user_tab_cols t where table_name = 'TEST_COLS'