sql查询语句

来源:9-7 【技能逐步提升】载入模板文件并实现列索引到列名的映射

qq_愿闻花开不谢_0

2019-10-30

这条语句中的table_schema代表什么,为什么我查的有的是数据库名,有的是information_schema?

SELECT
table_schema,
table_name,
column_name,
ordinal_position
FROM information_schema.columns
WHERE table_schema = ?
AND table_name = ?

写回答

1回答

张勤一

2019-10-30

同学你好:

    information_schema 是 MySQL 的内置数据库(可以打开 MySQL 客户端看看)。这条语句查询的就是 information_schema 数据库中的 columns 表。

    select 中的当然就是 columns 中的各个数据列,table_schema 代表的就是数据库名。


    欢迎来 QQ 群随时交流、讨论,也非常感谢同学的支持!

2
0

Spring Cloud微服务架构 设计实现广告系统

广告营销系统,未来大中型企业的标配

2136 学习 · 927 问题

查看课程