最多16列。
create table test (
f1 int,
f2 int,
f3 int,
f4 int,
f5 int,
f6 int,
f7 int,
f8 int,
f9 int,
f10 int,
f11 int,
f12 int,
f13 int,
f14 int,
f15 int,
f16 int,
f17 int
)
create index idx_test_16 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16)
create index idx_test_17 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17)
运行结果如下:
mysql>create table test (
-> f1 int,
-> f2 int,
-> f3 int,
-> f4 int,
-> f5 int,
-> f6 int,
-> f7 int,
-> f8 int,
-> f9 int,
-> f10 int,
-> f11 int,
-> f12 int,
-> f13 int,
-> f14 int,
-> f15 int,
-> f16 int,
-> f17 int
->)
Query OK, 0 rows affected (0.06 sec)
mysql>
mysql>create index idx_test_16 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16)
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>create index idx_test_17 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17)
ERROR 1070 (42000): Too many key parts specifiedmax 16 parts allowed
mysql>
mysql一个表里面最多多少个列数据库版本
QUOTE:
mysql>select version()
+---------------+
| version() |
+---------------+
| 5.1.26-rc-log |
+---------------+
1 row in set (0.00 sec)
表结构:
mysql>create table t1(id int)
shell脚本.()
QUOTE:
#!/bin/sh
#for ((x=3x<3000i++))
x=3
while [ $x -le 3000 ]
do
mysql -uroot -psuretech -Dtest <<EOF >>/root/add_col_test.log
alter table t1 add column f$x char(1)
EOF
x=`expr $x + 1`
done
结果是:2599
因为用的是CHAR(1),如果用NVARCHAR(500)就只能加32列了
如果char(100),那样只有655行.
这样说是与字段有关系的.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)