繁体   English   中英

更改忽略表中的 MySQL 5.6.20 错误

[英]MySQL 5.6.20 error in alter ignore table

我添加这一行以将ignore添加到 MySql 数据库:

ALTER IGNORE cms_books_author name ADD UNIQUE(name)

但我收到此错误:

Error
SQL query:


ALTER IGNORE cms_books_author name ADD UNIQUE(name)
MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'efcms_books_author name ADD UNIQUE(name)' at line 1 

Mysql 版本为: 5.6.20

我该如何解决这个错误? 谢谢你。

语法问题

  1. 更改忽略缺少 table 关键字
  2. 语法应仅包含唯一索引中的名称,而不应包含在表名之后

调整

ALTER IGNORE table cms_books_author ADD UNIQUE(name);

sqlfiddle


更改表语法

ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name [alter_specification [, alter_specification] ...] [partition_options] ... alter_specification: table_options | ADD [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,...) [index_option] ...

暂无
暂无

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

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