MySQL與Oracle表結構查詢語句

2021-10-23 17:24:13 字數 1197 閱讀 2178

mysql:

select

column_name 欄位名稱,

column_type 字段型別,

column_default 預設值,

character_maximum_length as 最大長度,

(case

when is_nullable =

'no'

then

'否'else

'是'end

)as 是否可空,

(case

when column_key =

'pri'

then

'是'else

'否'end

)as 是否主鍵,

column_comment 描述

from

information_schema.

columns

where

table_schema =

'running'

-- 資料庫名稱

and table_name =

'sys_dict_type'

-- 表名稱

oracle:

select

--uc.table_name 表名,

--utc.comments 表說明,

uc.column_name 欄位名,

ucc.comments 字段說明,

uc.data_type 資料型別,

uc.data_length 長度,

uc.nullable 是否為空,

uc.data_default 預設值

from cols uc, user_col_comments ucc, user_tab_comments utc

where uc.table_name = ucc.table_name

and uc.column_name = ucc.column_name

and uc.table_name = utc.table_name

and uc.table_name =

'rep_substance_message'

--***(一定要注意表名大寫)

order

by uc.table_name, uc.column_id

MySQL筆記建立表結構 MySQL表結構筆記9

本篇大綱 mysql資料表 建立表建立主鍵 auto increate 指定預設值 更新表結構 刪除表,重新命名表 01 表 mysql 資料庫的表是乙個二維表,由乙個或多個資料列構成 每個資料列都有它的特定型別,該型別決定了mysql如何看待該列資料 02 建立表 命令 格式 使用create t...

Oracle 匯出表結構

分析oracle下匯出某使用者所有表的方法 可能很多使用oracle的客戶都會遇到想把某使用者所有表匯出的情況,本文就提供這樣乙個方法幫你輕鬆解決這個問題。首先在sqlplus下以該使用者登入到oracle資料庫,然後將以下內容貼上到sqlplus中 set feedback off set pag...

oracle 查詢表結構

通過資料字典來獲取,select table name,column name,data type,data length from user tab columns where table name not in select view name from user views and table...