1. 程式人生 > 其它 >MYSQL資料庫表名查詢以及欄位查詢

MYSQL資料庫表名查詢以及欄位查詢

技術標籤:mysqlsqlmybatis

  1. 查詢自己建立的表名稱
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_schema = (select database()) and table_name NOT LIKE '%IN_%' 

結果如下:

2.根據表名稱查詢指定表字段以及型別。

SELECT
	TABLE_NAME,
	column_name,
	DATA_TYPE,
	column_comment 
FROM
	information_schema.COLUMNS
	WHERE table_name=''

結果如下: