mysql查看表结构的三种方法总结
SELECT
TABLE_SCHEMA AS '库名',
TABLE_NAME AS '表名',
COLUMN_NAME AS '列名',
ORDINAL_POSITION AS '列的排列顺序',
COLUMN_DEFAULT AS '默认值',
IS_NULLABLE AS '是否为空',
DATA_TYPE AS '数据类型',
CHARACTER_MAXIMUM_LENGTH AS '字符最大长度',
NUMERIC_PRECISION AS '数值精度(最大位数)',
NUMERIC_SCALE AS '小数精度',
COLUMN_TYPE AS '列类型',
COLUMN_KEY 'KEY',
EXTRA AS '额外说明',
COLUMN_COMMENT AS '注释'
FROM
information_schema.`COLUMNS`
WHERE
TABLE_SCHEMA = 'db_name'
ORDER BY
TABLE_NAME,
ORDINAL_POSITION;
相关文章
- 关于Mysql中current_time/current_date()与now()区别
- 一文带你了解MySQL四大类日志
- 解决远程连接MySQL报错:2003 - Can‘t connect to MySQL server on ‘X.X.X.X‘ (10060 “Unknown error“)问题
- MySQL数据库的多种连接方式及工具
- Ubuntu系统安装mysql超详细步骤
- MySQL外键约束(FOREIGN KEY)的具体使用
- Sql Server Management Studio连接Mysql的实现步骤
- 最新Navicat 15 for MySQL破解+教程 正确破解步骤
- Mysql exists用法小结
- C++连接mysql数据库(改进版)