赞
踩
查询mysql表和字段信息的语句记录
库名是:base
表名是:data
查询数据库信息,有几个表显示几行
select * from information_schema.tables where table_schema="base" and table_type='base table';
结果(太长了分成两个图):
查询表信息
- SELECT
- table_name,
- table_comment,
- create_time,
- update_time
- FROM
- information_schema. TABLES
- WHERE
- table_schema = (SELECT DATABASE())
- AND table_name = "data";
结果:
查询字段信息:
- SELECT
- column_name,
- data_type,
- column_comment
- FROM
- information_schema. COLUMNS
- WHERE
- table_name = "data"
- AND table_schema = (SELECT DATABASE())
- ORDER BY
- ordinal_position;
结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。