查询表结构:
SELECT column_name FROM information_schema.columns WHERE table_name='表名';
查询主键字段名
SELECT column_name FROM INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` WHERE table_name='表名' AND constraint_name='PRIMARY'
查询表结构:
SELECT column_name FROM information_schema.columns WHERE table_name='表名';
查询主键字段名
SELECT column_name FROM INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` WHERE table_name='表名' AND constraint_name='PRIMARY'