为什么我无法根据不是主键的条件更新列

Gau*_*rma 0 mysql sql

为什么我无法根据不是主键的条件更新列.

我正在尝试更新名称与特定标准匹配的选区表,如下所示,但以下查询显示错误


Error code 1064, SQL state 42000: 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 'table constituencies set city_id = '1' where constituencies.name = "East Delhi"' at line 1


update table constituencies set city_id = '1' where constituencies.name = "East Delhi";
update table constituencies set city_id = '1' where constituencies.name = "South Delhi";
update table constituencies set city_id = '1' where constituencies.name = "Delhi Sadar";
update table constituencies set city_id = '1' where constituencies.name = "Karol Bagh";
update table constituencies set city_id = '1' where constituencies.name = "New Delhi";
update table constituencies set city_id = '1' where constituencies.name = "Outer Delhi";
update table constituencies set city_id = '1' where constituencies.name = "North East Delhi";
update table constituencies set city_id = '1' where constituencies.name = "North West Delhi";
update table constituencies set city_id = '1' where constituencies.name = "West Delhi";

是否有必要仅使用主键检查条件?

请注意上面的内容.

Sal*_*lil 10

尝试

update constituencies set city_id = 1 where constituencies.name = "East Delhi";
Run Code Online (Sandbox Code Playgroud)

您不需要在mysql查询中编写表.