查詢表結構:
select * from user_tab_columns where table_name = '大寫表名';
查看表結構&欄位注釋
select
a.column_name,
b.comments,
a.DATA_TYPE || '(' || A .DATA_LENGTH || ')' 型別
from
user_tab_columns a,
user_col_comments b
where
a.table_name = '大寫表名'
and a.table_name = b.table_name
and a.column_name = b.column_name
隨機查詢 N 條資料:
select * from (select * from [表名] order by sys_guid()) where rownum <= N;
遞回查詢:
select * from [表名] start with [條件] connect by [子級欄位] = prior [父級欄位];
??【栗子】
-- 向下遞回
select * from organization start with id = 10 connect by parent_id = prior id;
-- 向上遞回
select * from organization start with id = 10 connect by id = prior parent_id;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/308498.html
標籤:Oracle
