mysql查詢表和字段信息sql語句

查詢mysql表和字段信息的語句記錄

庫名是:base

表名是:data

查詢數據庫信息,有幾個表顯示幾行

select * from information_schema.tables where table_schema="base" and table_type='base table';

結果(太長了分成兩個圖):

查詢表信息

SELECT
	table_name,
	table_comment,
	create_time,
	update_time
FROM
	information_schema. TABLES
WHERE
 table_schema = (SELECT DATABASE())
AND table_name = "data";

結果:

查詢字段信息:

SELECT
	column_name,
	data_type,
	column_comment
FROM
	information_schema. COLUMNS
WHERE
	table_name = "data"
AND table_schema = (SELECT DATABASE())
ORDER BY
	ordinal_position;

結果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章