![]() |
Prázdná hodnota NULL |
SQL> select count(*) from dual where 1 = 1; COUNT(*) ---------- 1 TRUE SQL> select count(*) from dual where 0 = 1; COUNT(*) ---------- 0 FALSE SQL> |
SQL> select count(*) from dual where null = 1; COUNT(*) ---------- 0 UNKNOWN SQL> select count(*) from dual where null != 1; COUNT(*) ---------- 0 UNKNOWN SQL> |
SQL> select count(*) from dual where null is null; COUNT(*) ---------- 1 TRUE SQL> select count(*) from dual where null is not null; COUNT(*) ---------- 0 FALSE SQL> |
SQL> select count(*) from dual where 1 in (1, 2, 3); COUNT(*) ---------- 1 TRUE SQL> select count(*) from dual where 4 in (1, 2, 3); COUNT(*) ---------- 0 FALSE SQL> |
SQL> select count(*) from dual where null not in (1, 2, 3); COUNT(*) ---------- 0 UNKNOWN SQL> |
select count(*) from dual where null not in (1, 2, 3) or null is null; COUNT(*) ---------- 1 TRUE SQL> |
A | B | A and B | A or B | not A |
True | True | True | True | False |
True | False | False | True | False |
True | Unknown | Unknown | True | False |
False | True | False | True | True |
False | False | False | False | True |
False | Unknown | False | Unknown | True |
Unknown | True | Unknown | True | Unknown |
Unknown | False | False | Unknown | Unknown |
Unknown | Unknown | Unknown | Unknown | Unknown |
ID osoby | ID nadřízeného | Příjmení | Jméno | Číslo karty |
1 | null | Dudacek | Vlastimil | 1 |
2 | 1 | Vavricka | Karel | 4 |
3 | 1 | Herout | Stanislav | 5 |
4 | 2 | Rohlik | Maxmilian | 6 |
5 | 2 | Pesicka | Ondrej | 7 |
6 | 2 | Bokr | Pavel | 8 |
7 | 3 | Dura | Antonin | null |
SQL> select count(*) from osoby; COUNT(*) ---------- 7 |
SQL> select count(id_nad) from osoby; COUNT(ID_NAD) ------------- 6 SQL> select count(*) from osoby where id_nad is not null; COUNT(*) ---------- 6 |
SQL> select count(*) from osoby where id_nad is null; COUNT(*) ---------- 1 |
SQL> select count(*) from osoby where id_nad != 1; COUNT(*) ---------- 4 |
SQL> select count(*) from osoby where id_nad != 1 or id_nad is null; COUNT(*) ---------- 5 |