我想在书库表中插入plane_id,其中书列的值为"否"。我的书库桌子是
hangar_id | book | plane_id
-------------------------------
han103 | no | null
han104 | yes |pla102
我尝试的查询是
insert into bookhangar (plane_id) values('pla104') where book='no';
但它没有插入。
我尝试了另一个查询
update bookhangar set plane_id='PLA104' where book='no';
它也不起作用。
如果有任何行包含值"no",它将更新
update bookhangar set plane_id='PLA104' where lower(trim(book))='no';
您的更新应该正常工作:
update bookhangar
set plane_id = 'PLA104'
where book = 'no';
如果没有,我将首先检查此查询是否有效
select *
from bookhangar
where book = 'no';
我怀疑这不会返回任何行。 所以,试试这个:
select *
from bookhangar
where book like '%no%';
您将需要调查真正存储的价值。 。也许它有隐藏字符,例如字符串开头的空格。