1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > mysql忽略列_mysql – 使用SQL语句更改忽略表添加列(如果不存在)

mysql忽略列_mysql – 使用SQL语句更改忽略表添加列(如果不存在)

时间:2020-01-05 11:32:51

相关推荐

mysql忽略列_mysql – 使用SQL语句更改忽略表添加列(如果不存在)

根据

documentation:

IGNORE is a MySQL extension to standard SQL. It controls how ALTER

TABLE works if there are duplicates on unique keys in the new table or

if warnings occur when strict mode is enabled. If IGNORE is not

specified, the copy is aborted and rolled back if duplicate-key errors

occur. If IGNORE is specified, only one row is used of rows with

duplicates on a unique key. The other conflicting rows are deleted.

Incorrect values are truncated to the closest matching acceptable

value.

也就是说,它用于不同的目的,而不是所有错误.你想要的是ALTER TABLE ADD IF NOT IF EXISTS,并且该语法不存在.

在存储过程中,您可以使用if语句来查看列是否已存在(使用INFORMATION_SCHEMA.COLUMNS).

Here是一个显示相同问题的SQL小提琴.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。