简体   繁体   English

视图中的最大列数

[英]Maximum number of columns in view

There is a (complex) maximum number of columns in a table in mySQL. mySQL中的表中有(复杂)最大列数。

But what about a maximum number of columns in a view? 但是,视图中的最大列数呢?

I mean, a view might be a join of numerous tables. 我的意思是,一个视图可能是许多表的联接。 Will there be a maximum of the total number of columns? 列总数最多吗?

Thanks in advance. 提前致谢。

According to the MySQL 5.7 reference manual , there is a maximum of 4096 columns per table. 根据MySQL 5.7参考手册 ,每个表最多有4096列。 I am not sure if this is also the case for queries though I would assume so and I also don't think that you would practically every have a database table or search query with over that amount. 我不确定查询是否也是如此,但我也不认为您实际上每个人都有一个数据库表或搜索查询量超过该数量。

By way of example, a questionnaire table might look like this: 举例来说,调查表可能如下所示:

questionnaire_id, question_no, question
               1            1  What is your name?
               1            2  Where do you live?
               1            3  What is your favourite colour?
               2            1  What is the capital of France?
               2            2  Who wrote Beethoven's Fifth?
               2            3  When was the Great Fire of London?

So, there we have two questionnaires (of potentially unlimited length) occupying exactly 3 columns in a table. 因此,我们有两个问卷(可能无限长),它们恰好占据了表中的3列。

Any remaining 'user-experience' issues would properly be handled in application code. 任何剩余的“用户体验”问题都可以在应用程序代码中正确处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM