====== Užitečné SQL příklady ======
===== COALESCE =====
select COALESCE(IDZakaz, '') from ...
select * from rozpocty_rozpocty where COALESCE(IDzakaz, '') = ''
===== EXISTS =====
Nepoužívat konrstrukce subselectů "not in (select ...)", ale predikát EXISTS.
select * from sklad_vc vc
where
not exists (select * from sklad_prijemky prijemky where prijemky.idprijemka=vc.idprijemka)
===== CASE =====
select
CASE
WHEN (field = 1) THEN 'x'
WHEN (field = 2) THEN 'y'
ELSE 'z'
END
from ...
===== SUBSTRING =====
select SUBSTRING(field FROM 1 FOR 5) from ...