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

sql命令行顯示資料庫表結構

發布時間: 2023-04-07 14:15:17

Ⅰ 怎麼用sql語句查看Informix資料庫表中的結構

informix查詢表結構方法有多種,可以通過系統信息表查詢,也可以通過系統功能查詢
查詢系統表存儲信息步驟:
登錄資料庫
dbaccess
xxxdb
;
執行查詢語句
SELECT
c.colname[1,20],
c.coltype,
c.collength
FROM
syscolumns
c,
systables
t
WHERE
c.tabid
=
t.tabid
AND
t.tabname
=
'xxxTable';
通過系統提供的命令功能查詢:
dbaccess
-
info
查詢表信息
dbschema命令導出表結構

Ⅱ 如何通過sql 查看錶的結構

在查詢分析器中用SQL語句

Ⅲ 如何通過sql查看錶的結構

在查詢分析器中用SQL語句
可輸入以下編碼進行查看
1.
sp_help
tablename
(tablename是你要查看錶結構的表名)
2.
select
*
from
information_schema.columns
where
table_name=你要查的表名
3.
初級:使用管理工具SSMS

右側對象樹展開即可
4.
中級:sp_HelpText
表名
5.
高級:用SQL查詢系統元數據

Ⅳ 顯示資料庫的結構應使用的命令是(VFP)

打開數據差基庫的命令是:open
database
資料庫名.
修改資料庫的命高燃令虛念謹是:modify
database
資料庫名.
你輸入的是datebase,錯了一個字母,當然不能識別了

Ⅳ mysql中查詢資料庫中表名稱和結構的sql語句是什麼啊啊

TABLE 語句

具體語法:TABLE table_name [ORDER BY column_name] [LIMIT number [OFFSET number]]
其實從語法上看,可以排序,也可以過濾記錄集,不過比較簡單,沒有 SELECT 那麼強大。

示例 1

簡單的建一張很小的表 y1,記錄數為 10 條。表 t1,插入 10 條記錄

  • mysql-(ytt/3305)->create table t1 (r1 int,r2 int);

  • Query OK, 0 rows affected (0.02 sec)

  • mysql-(ytt/3305)->insert into t1

  • with recursive aa(a,b) as (

  • select 1,1

  • union all

  • select a+1,ceil(rand()*20) from aa where a < 10

  • ) select * from aa;

  • Query OK, 10 rows affected (0.00 sec)

  • Records: 10 Duplicates: 0 Warnings: 0

  • 簡單全表掃描mysql-(ytt/3305)->select * from t1;+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)

  • TABLE 結果mysql-(ytt/3305)->table t1;+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)

  • 看下 table 的執行計劃mysql-(ytt/3305)->explain table t1 order by r1 limit 2G*************************** 1. row *************************** id: 1 select_type: SIMPLE table: t1 partitions: NULL type: ALLpossible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 10 filtered: 100.00 Extra: Using filesort1 row in set, 1 warning (0.00 sec)

  • 其實可以看到 TABLE 內部被 MySQL 轉換為 SELECT 了。mysql-(ytt/3305)->show warningsG*************************** 1. row *************************** Level: Note Code: 1003Message: /* select#1 */ select `ytt`.`t1`.`r1` AS `r1`,`ytt`.`t1`.`r2` AS `r2` from `ytt`.`t1` order by `ytt`.`t1`.`r1` limit 21 row in set (0.00 sec)

  • 那其實從上面簡單的例子可以看到 TABLE 在內部被轉成了普通的 SELECT 來處理。示例 2應用於子查詢里的子表。這里要注意,內表的欄位數量必須和外表過濾的欄位數量一致。克隆表 t1 結構mysql-(ytt/3305)->create table t2 like t1;Query OK, 0 rows affected (0.02 sec)

  • 克隆表 t1 數據mysql-(ytt/3305)->insert into t2 table t1;Query OK, 10 rows affected (0.00 sec)Records: 10 Duplicates: 0 Warnings: 0

  • table t1 被當做內表,表 t1 有兩個欄位,必須同時滿足 t2 檢索時過濾的欄位也是兩個。mysql-(ytt/3305)->select * from t2 where (r1,r2) in (table t1);+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)

  • 注意:這里如果過濾的欄位數量和子表數量不一致,則會報錯。

Ⅵ MSSQL 顯示表結構(欄位名 數據類型 長度)的系統存儲過程是什麼

試試下面的語句SELECT
表名=case when a.colorder=1 then d.name else '' end,
表說明=case when a.colorder=1 then isnull(f.value,'') else '' end,
欄位序號=a.colorder,
欄位名=a.name,
標識=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end,
主鍵=case when exists(SELECT 1 FROM sysobjects where xtype='PK' and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid
))) then '√' else '' end,
類型=b.name,
佔用位元組數=a.length,
長度=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
小數位數=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
允許空=case when a.isnullable=1 then '√'else '' end,
默認值=isnull(e.text,''),
欄位說明=isnull(g.[value],'')
FROM syscolumns a
left join systypes b on a.xusertype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name <>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid
left join sysproperties f on d.id=f.id and f.smallid=0
--where d.name='TWebInfo' --如果只查詢指定表,加上此條件
order by a.id,a.colorder

Ⅶ plsql怎麼看錶結構

  • 方式一:

    按住ctrl鍵不放,滑鼠左鍵點擊表名稱,即顯示表的一切詳細情況(表空間,表名稱,索引,列,鍵,許可權,觸發器 ...)

Ⅷ sql server怎麼查看錶結構

SQL Server查詢表結構語句

--1:獲取當前資料庫中的所有用戶表 www.2cto.com
select Name from sysobjects where xtype='u' and status>=0
--2:獲取某一個表的所有欄位
select name from syscolumns where id=object_id('表名')
--3:查看與某一個表相關的視圖、存儲過程、函數
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'

--4:查看當前資料庫中所有存儲過程
select name as 存儲過程名稱 from sysobjects where xtype='P'
--5:查詢用戶創建的所有資料庫
select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')
或者
select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01

--6:查詢某一個表的欄位和數據類型
select column_name,data_type from information_schema.columns
where table_name = '表名'

Ⅸ 怎樣用 SQL 查看錶結構

用管理員用戶登陸資料庫伺服器,輸入:dbschema -d 資料庫名稱 -t 表名 -ss

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

分兩種方法:

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

desc表名;