根据表名获取所有字段信息
SELECT column_name, data_type, column_comment, extra FROM information_schema.columns
WHERE table_name = 'sys_student' AND table_schema = 'ry' ORDER BY ordinal_position
获取数据库的所有表
SELECT table_name, table_comment, create_time, update_time FROM information_schema.tables
WHERE table_comment <>'' AND table_schema = 'ry'
这个在代码生成脚手架中经常使用,前台页面列表显示所有数据库中的表,然后根据表的字段信息生成代码文件,结合配置文件(包路径,类前缀等),常常使用模板引擎进行生成,如velocity