SQL语句,给正在写毕业设计终稿的同学,导出数据库表
select Column_Name as 列名,data_type as 数据类型,
(case when data_type = 'datetime' then 8 when 'date' then 3 when data_type = 'float' or data_type = 'double' or data_type = 'int' or data_type = 'decimal' then NUMERIC_PRECISION else CHARACTER_MAXIMUM_LENGTH end ) as 长度,
(case when COLUMN_KEY='PRI' then '是' else '否' end) as 主键,COLUMN_COMMENT as 说明
from information_schema.columns where table_schema ='foodstore' and table_name = 'food' order by ORDINAL_POSITION asc
举例子:可以用Navicat导出到Word文档再复制到你的毕设终稿。