當前位置:首頁 » 編程語言 » oraclesql顯示表結構
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

oraclesql顯示表結構

發布時間: 2022-08-10 15:34:55

㈠ oracle sql語句 顯示樹形結構

設計的表結構不合理,怎麼能用對象設計表呢。組多兩個欄位, people_id,parent_id
只關心他們的層級關系即可。
查詢出來是
select t.people_id, t.parent_id from family t
start with t.people_id is null connect by nocycle prior t.people_id=t.parent_id。

真多多層級查詢毫無壓力。另外 對 函數的理解多參考下語法用途。nocycle 防止死循環。可以舉一反三,自己試一下 start with 中 people_id 與 parent_id 互換位置,會有額外收獲,多動手。祝你oracle 之旅愉快~

㈡ PLSQL怎樣導出oracle表結構

PLSQL導出oracle表結構的具體步驟如下:

我們需要准備的材料分別是:電腦、PL/SQL Developer軟體。

1、首先我們打開需要編輯的oracle資料庫,點擊打開「tools」。

㈢ ORACLE環境下用SQL語句查詢一個表的結構用什麼語句

先看看如果你不加WHERE條件能不能取到數據,如果能,那就不是許可權了。
另外,除了USER_TAB_COLUMNS,同樣還有一張表,ALL_TAB_COLUMNS,是所有表空間的數據。也可以用這個表。

㈣ 如何查看oracle資料庫所有表結構圖

覺得你應該先弄清楚oracle的常規數據字典的結構,像9i里的常規數據字典中對象名稱就有以USER,ALL,DBA為前綴的對象。
以USER為例,我們查該對象下有些什麼表,就應該執行下列的語句:
SQL>select table_name from user_tables;
類似的,你可以進行替換。:)

如果你想查資料庫中所有的表的話,可以查詢
SELECT * FROM dba_tables

如果你想查詢資料庫中某個用戶下的表的話,也可以登錄這個用戶,再查詢:
SELECT * FROM USER_TABLES

要想導入外部sql語句可以用命令
sql >@e:\文件名.sql

如你想保存 select * from tablename;語句的結果,可以在sql*plus 裡面這樣:

SPOOL c:\test.sql //這是保存文件的位置
select * from tablename;
SPOOL OFF

㈤ 怎麼顯示Oracle資料庫表中的列

顯示Oracle資料庫表中的列有以下兩種方式。

1、在命令窗口下輸入desc 表名。

如:

desctest;

注意:表名必須大寫。

㈥ 如何用SQL語句獲取Oracle表結構

利用sql語句查詢某個表的結構的方法:

通過Oracle中的user_tab_cols, user_col_comments, user_constraints, user_cons_columns表聯合查詢。
1、user_tab_cols用來獲取對應用戶表的列信息;
2、user_col_comments用來獲取對應用戶表列的注釋信息;
3、user_constraints用來獲取用戶表的約束條件;
4、user_cons_columns約束中用戶可訪問列。

示例代碼:
select t.table_name,
t.column_name,
t.data_type,
t.data_length,
t.nullable,
t.column_id,
c.comments,
(SELECT CASE
WHEN t.column_name = m.column_name THEN
1
ELSE
0
END
FROM DUAL) iskey
FROM user_tab_cols t,
user_col_comments c,
(select m.column_name
from user_constraints s, user_cons_columns m
where lower(m.table_name) = 'qh_outstoresabinfo'
and m.table_name = s.table_name
and m.constraint_name = s.constraint_name
and s.constraint_type = 'P') m
WHERE lower(t.table_name) = 'qh_outstoresabinfo'
and c.table_name = t.table_name
and c.column_name = t.column_name
and t.hidden_column = 'NO'
order by t.column_id

㈦ oracle怎麼通過sql查看錶的結構

分兩種方法:

1、在命令窗口通過如下語句:

desc表名;

㈧ oracle中,如何利用sql語句查詢某個表的結構

利用sql語句查詢某個表的結構的方法:

通過Oracle中的user_tab_cols, user_col_comments, user_constraints, user_cons_columns表聯合查詢。
1、user_tab_cols用來獲取對應用戶表的列信息;
2、user_col_comments用來獲取對應用戶表列的注釋信息;
3、user_constraints用來獲取用戶表的約束條件;
4、user_cons_columns約束中用戶可訪問列。

示例代碼:

selectt.table_name,
t.column_name,
t.data_type,
t.data_length,
t.nullable,
t.column_id,
c.comments,
(SELECTCASE
WHENt.column_name=m.column_nameTHEN
1
ELSE
0
END
FROMDUAL)iskey
FROMuser_tab_colst,
user_col_commentsc,
(selectm.column_name
fromuser_constraintss,user_cons_columnsm
wherelower(m.table_name)='qh_outstoresabinfo'
andm.table_name=s.table_name
andm.constraint_name=s.constraint_name
ands.constraint_type='P')m
WHERElower(t.table_name)='qh_outstoresabinfo'
andc.table_name=t.table_name
andc.column_name=t.column_name
andt.hidden_column='NO'
orderbyt.column_id

㈨ 在oracle資料庫中怎麼顯示所有的表,比如mysql 有show tables 在oracle中怎麼弄謝謝

如果你的用戶名叫 dbuser

在sql*plus中

select table_name from all_tables where owner='dbuser';

關鍵就是all_tables這個視圖

就可以顯示出用戶名為dbuser可以訪問到的表的名字了

如果你有dba許可權的就可以查 dba_tables,就可以查出資料庫裡面所有的表的情況

另:

SQL> @s<回車>

會自動查詢當前用戶下的所有表、視圖、同義詞。

我也是oracle的新手,推薦一個網站www.itpub.net,你會有驚喜的

end