简体   繁体   English

如何在MySQL中更改表?

[英]How to Alter Table in the mysql?

I'm having a problem while ALTER TABLE . 我在ALTER TABLE遇到问题。 The reason am altering table is "Because of its length, this column might not be editable." 更改表的原因是“由于其长度,此列可能不可编辑。”

在此处输入图片说明

MySQL said: Documentation MySQL说:文档

#1064 - You have an error in your SQL syntax; #1064-您的SQL语法有误; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)' at line 1 检查与您的MariaDB服务器版本相对应的手册以在第1行的'COLUMN description(MAX_ROWS = 1000000000 AVG_ROW_LENGTH = 1000000000)'附近使用正确的语法

My Sql Query 我的SQL查询

ALTER TABLE oc_information_description COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)

Should be the table length increase and don't truncate my data. 应该增加表的长度,并且不要截断我的数据。

Your root problem is the following note on phpMyAdmin on column description : 您的根本问题是有关列description phpMyAdmin的以下description

Because of its length, this column might not be editable. 由于其长度,此列可能不可编辑。

In this case the current data type TEXT is to small so there is no space to add more data to the field. 在这种情况下,当前数据类型TEXT很小,因此没有空间向该字段添加更多数据。 You can change the data type with the following ALTER TABLE to a bigger one ( MEDIUMTEXT or LONGTEXT ): 您可以使用以下ALTER TABLE将数据类型ALTER TABLE为更大的数据类型( MEDIUMTEXTLONGTEXT ):

ALTER TABLE oc_information_description MODIFY description MEDIUMTEXT

Your second issue is the wrong sql syntax (trying to solve the first issue): 您的第二个问题是错误的sql语法(试图解决第一个问题):

1064 - You have an error in your SQL syntax; 1064-您的SQL语法有误; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLUMN description (MAX_ROWS = 1000000000 AVG_ROW_LENGTH=1000000000)' at line 1 检查与您的MariaDB服务器版本相对应的手册以在第1行的'COLUMN description(MAX_ROWS = 1000000000 AVG_ROW_LENGTH = 1000000000)'附近使用正确的语法

You can't specify the AVG_ROW_LENGTH or MAX_ROWS for a specific column. 您不能为特定列指定AVG_ROW_LENGTHMAX_ROWS You can specify them for table only. 您只能为表指定它们。 You can change these values with the following ALTER TABLE : 您可以使用以下ALTER TABLE更改这些值:

ALTER TABLE oc_information_description AVG_ROW_LENGTH = 1000000000, MAX_ROWS = 1000000000

table_options signifies table options of the kind that can be used in the CREATE TABLE statement, such as ENGINE , AUTO_INCREMENT , AVG_ROW_LENGTH , MAX_ROWS , ROW_FORMAT , or TABLESPACE . table_options表示可以在CREATE TABLE语句中使用的表选项,例如ENGINEAUTO_INCREMENTAVG_ROW_LENGTHMAX_ROWSROW_FORMATTABLESPACE

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

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