Can I use where true instead of where 1 conditions when concatenating where conditions in sql statements?

1 the result is that true, is tested after using where true

  1. all conditions are null
  2. the first condition is null
  3. all are not null

can get the right result, and where 1 can get the right result. After google, it is found that no one has done so. Why

SELECT * FROM `table` WHERE 1=1
SELECT * FROM `table` WHERE TRUE
SELECT * FROM `table` WHERE 1
Nov.12,2021

it is generally believed that the compatibility of where 1 is better than that of where true, because different databases deal with boolean differently, which can easily lead to some problems.

Menu