使用mysql查看表結構可以通過簡單的命令達到目的。
假設有一個yanggb表。
1.desc/describle命令。
desc yanggb;
describle yanggb;
2.show命令。
show create table yanggb;
show columns from yanggb;
show fields from yanggb;
show full fields from yanggb;
此外,也可以通過查詢mysql中的存儲表定義的內置表來達到目的。
select * from information_schema.columns where table_schema = 'db' -- 表所在數據庫名 and table_name = 'yanggb'; -- 表名
當然,如果有現成的mysql數據庫工具,還可以使用mysql數據庫工具中提供的查看表結構的相關功能(一般都會有),會更方便快捷。
"生命中所有得到的禮物,早已在暗中標好了價格。"