N
N
NubasLol2020-04-13 21:30:44
PostgreSQL
NubasLol, 2020-04-13 21:30:44

Why does where crookedly work with boolean?

select count(*) from  orders  where is_break  is null or is_break = false //результат 895
select count(*) from  orders  where is_break != true //результат 0

is_break is boolean

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2020-04-13
@NubasLol

Because SQL is ternary logic. true, false and NULL: https://www.postgresql.org/docs/current/functions-...
null != whatever - will be null in the result.

D
Dimonchik, 2020-04-13
@dimonchik2013

well, if everything is true for you, how else to answer him?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question