For example, there is such a SQL query, example:

update house_rooms set is_closed = 1 and is_empty = 1 where owner_id = ? and status = ? 

It was created for an example. You shouldn’t look for logic in it, the problem is that it works, but it shouldn’t be because the set syntax is incorrect, that is, if you replace:

 set hr.is_closed = 1 and hr.is_empty = 1 

On line:

 set hr.is_closed = 1, hr.is_empty = 1 

Then it runs and changes values.

The question itself: why does not it give an error, but shows that the request worked?

BD: MariaDB 10.2, but I think it will not affect the answer.

  • Comma-separated, and it works for you. What is the question? - Yura Ivanov
  • What does "no result" mean? What result do you expect? - Anton Shchyrov
  • @YuraIvanov I wrote - "but why it does not give an error, but it shows that the request worked" - Yaroslav Molchan
  • 2
    There is no syntax error. Expression 1 and is_empty = 1 legal boolean expression and its result is assigned is_closed - Yura Ivanov
  • one

1 answer 1

There is no syntax error. Expression 1 and is_empty = 1 legal boolean expression and its result is assigned to is_closed .
For example,

 select field1 and field2 from t; 

will produce the result of a Boolean conjunction of two fields.