文章摘要
这篇文章介绍了如何通过SQL查询获取`information_schema`表中的元数据信息,包括`information_schema.tables`和`information_schema.cOLUMNS`两张表的内容。`information_schema.tables`表存储了数据库表的结构信息,包括表名、数据类型、约束等;`information_schema.cOLUMNS`表存储了表中列的详细信息,如列名、数据类型、长度等。文章还提供了一种通过连接这两张表并使用`SHOW TABLES`和`SHOW COLUMNS`命令来查看表结构和列信息的方法,并展示了如何通过`concat_ws`函数生成一张完整的表结构表的示例。这些方法可以帮助用户快速了解数据库的元数据和表结构。
select concat_ws(0x2f,information_schema.tables.table_schema,`information_schema`.`COLUMNS`.table_name,`information_schema`.`COLUMNS`.column_name) from `information_schema`.`COLUMNS` left join information_schema.tables on `information_schema`.`COLUMNS`.table_name=information_schema.tables.table_name where `information_schema`.`COLUMNS`.column_name like 0x257061737325 limit 0,1;
© 版权声明
文章版权归作者所有,未经允许请勿转载。