您可以插入表的最大列数/值数 - mysql [英] Maximum number of columns / values you can INSERT INTO a table - mysql

查看:53
本文介绍了您可以插入表的最大列数/值数 - mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道你可以插入一个表(mysql)的最大列数/值是多少?我收到一个错误... IDK... 20 列/值?(是的,#_of_col = #no_of_val)

Does anybody know what's the maximum number of columns/values you can insert into a table (mysql)? I get an error for... IDK... 20 columns/values? (yes, #_of_col = #no_of_val)

INSERT INTO comenzi (a,b,c,d,e,f,...) 
VALUES (1,2,3,4,5,6,...)

推荐答案

一个表中可以有 20 多个列,所以我认为这不是你的问题.

You can have more than 20 columns in a table so I don't think that is your problem.

很可能您的值列表中的列数有误,或者您的列名之一是关键字.

Most likely you have the wrong number of columns in your values list or one of your column names is a keyword.

您说您已经检查过值的数量是否正确.根据我的经验,用手数 20 是非常困难的,因此您可能需要仔细检查您是否正确数了数.

You said you've already checked that number of values is correct. In my experience counting 20 things by hand is very difficult so you might want to double-check that you've counted correctly.

但假设这不是问题,那么我猜这可能是因为您的列名之一是保留关键字.用反引号包围您的列名可防止它们被错误解析:

But assuming that isn't the problem then I'd guess that it's probably because one of your column names is a reserved keyword. Surrounding your column names with backticks prevents them being parsed incorrectly:

INSERT INTO comenzi (`a`, `b`, `c`, `d`, `e`, `f`, ...) 
VALUES (1, 2, 3, 4, 5, 6, ...)

你还应该确保如果你的值列表中有任何字符串,它们被引用并在必要时正确转义.

You should also make sure that if you have any strings in your value list that they are quoted and properly escaped if necessary.

这篇关于您可以插入表的最大列数/值数 - mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆