mysql常用查看表结构的SQL语句

1.查看表结构:

SELECT column_name,data_type FROM information_schema.columns WHERE table_name='数据库表名';

2.查看表的主键:

SELECT column_name AS 主键 FROM INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` WHERE table_name='数据库表名' AND constraint_name='PRIMARY'
posted @ 2019-12-31 21:53  三分魔系  阅读(609)  评论(0编辑  收藏  举报