查詢oracle表中最后一行數(shù)據(jù)(行順序與date字段無(wú)關(guān)):

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站建設(shè)、做網(wǎng)站、東安網(wǎng)絡(luò)推廣、微信小程序、東安網(wǎng)絡(luò)營(yíng)銷、東安企業(yè)策劃、東安品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供東安建站搭建服務(wù),24小時(shí)服務(wù)熱線:13518219792,官方網(wǎng)址:chinadenli.net
select
*
from
(select
*
from
table
order
by
rownum)
where
rownum
2;
查詢oracle表中最后一行數(shù)據(jù)(行順序與date字段有關(guān)):
select
*
from
(select
t.*
from
table
t
order
by
t.date)
where
rownum
2;
--第一種方法:
查詢dba_tab_columns
復(fù)制代碼
代碼如下:
select
COLUMN_NAME,DATA_TYPE,DATA_LENGTH
from
dba_tab_columns
where
table_name
=upper('表名')
order
by
COLUMN_NAME
--這種方法需要有DBA權(quán)限
--第二種方法:
查詢user_tab_cols
select
COLUMN_NAME,DATA_TYPE,DATA_LENGTH
from
user_tab_cols
where
table_name=upper('表名')
order
by
COLUMN_NAME
--這種方法只能查找當(dāng)前用戶下的表
--第三種方法:
查詢ALL_TAB_COLUMNS
select
distinct
COLUMN_NAME,DATA_TYPE,DATA_LENGTH
from
ALL_TAB_COLUMNS
WHERE
TABLE_NAME=
upper('表名')
--這種方法可以查詢所有用戶下的表
---------------------------補(bǔ)充-------------------------------------------------------------
復(fù)制代碼
代碼如下:
--增加字段
alter
table
cw_srcbpb
add
(SRCBPB_RJBPBL
varchar2(100)
);
alter
table
cw_srcbpb
modify
(SRCBPB_RJBPBL
number(30,3)
);
--Oracle查看所有表和字段
--獲取表:
select
table_name
from
user_tables;
--當(dāng)前用戶的表
select
table_name
from
all_tables;
--所有用戶的表
select
table_name
from
dba_tables;
--包括系統(tǒng)表
select
table_name
from
dba_tables
where
owner='LBSP';
--獲取用戶***所擁有的表這里的用戶名要記得是用大寫的。
--
獲取表字段:其實(shí)這里是根據(jù)用戶的權(quán)限來(lái)獲取字段的屬性(表名要大寫)
select
*
from
user_tab_columns
where
Table_Name='用戶表';--獲取用戶表的所有字段還有字段的屬性。
select
*
from
all_tab_columns
where
Table_Name='用戶表';--獲取用戶表的所有字段還有字段的屬性。所屬用戶是***
select
*
from
dba_tab_columns
where
Table_Name='用戶表';--獲取用戶表的所有字段還有字段的屬性。所屬用戶是***
--獲取表注釋:
select
*
from
user_tab_comments
--user_tab_comments:table_name,table_type,comments
--相應(yīng)的還有dba_tab_comments,all_tab_comments,這兩個(gè)比user_tab_comments多了ower列。
--獲取字段注釋:
select
*
from
user_col_comments
--user_col_comments:table_name,column_name,comments
--相應(yīng)的還有dba_col_comments,all_col_comments,這兩個(gè)比user_col_comments多了ower列。
--查詢出用戶所有表的索引
select
*
from
user_indexes
--查詢用戶表的索引(非聚集索引):
select
*
from
user_indexes
where
uniqueness='NONUNIQUE'
--查詢用戶表的主鍵(聚集索引):
select
*
from
user_indexes
where
uniqueness='UNIQUE'
--查詢表的索引
select
t.*,i.index_type
from
user_ind_columns
t,user_indexes
i
where
t.index_name
=
i.index_name
and
t.table_name='NODE'
--查詢表的主鍵
select
cu.*
from
user_cons_columns
cu,
user_constraints
au
where
cu.constraint_name
=
au.constraint_name
and
au.constraint_type
=
'P'
AND
cu.table_name
=
'NODE'
--查找表的唯一性約束(包括名稱,構(gòu)成列):
select
column_name
from
user_cons_columns
cu,
user_constraints
au
where
cu.constraint_name=au.constraint_name
and
cu.table_name='NODE'
--查找表的外鍵
select
*
from
user_constraints
c
where
c.constraint_type
=
'R'
and
c.table_name='STAFFPOSITION'
--查詢外鍵約束的列名:
select
*
from
user_cons_columns
cl
where
cl.constraint_name
=
外鍵名稱
--查詢引用表的鍵的列名:
select
*
from
user_cons_columns
cl
where
cl.constraint_name
=
外鍵引用表的鍵名
select?regexp_substr(age,'[0-9]+')?from?(
select?'1歲1月'?as?age?from?dual?
union?all?
select?'2歲1月'?as?age?from?dual?
union?all?
select?'56歲1月'?as?age?from?dual?
union?all?
select?'26歲1月'?as?age?from?dual?
union?all?
select?'48歲1月'?as?age?from?dual?
union?all?
select?'21歲1月'?as?age?from?dual?
union?all?
select?'44歲1月'?as?age?from?dual?
union?all?
select?'1歲45月'?as?age?from?dual?)
---oracle?只能用到10G以上的數(shù)據(jù)庫(kù)版本
文章標(biāo)題:oracle怎么取行字段,oracle中截取字段
本文地址:http://chinadenli.net/article40/dsgepeo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)公司、全網(wǎng)營(yíng)銷推廣、動(dòng)態(tài)網(wǎng)站、定制網(wǎng)站、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)