Skip to content

05-Compare

Fun: If
1. Using in data columns and scalar functions within SELECT statements
2. Using in data columns within WHERE conditions
3. Using in data columns within GROUP BY statements
4. Using in data columns within STATE WINDOW
5. Using in aggregate functions while including the IS NULL operator

Fun: ifnull()
1. Check "select ifnull(1, 0)";
2. Check "select ifnull(null, 10)";
3. Check "select ifnull(1/0, 10)";
4. Check "select ifnull(1/0, 'yes')";

Fun: nvl()
same with ifnull()

Fun: nullif()
1. Check "select nullif(1, 1)";
2. Check "select nullif(1, 2)";

Fun: nvl2()
1. Check "select nvl2(null, 1, 2)";
2. Check "select nvl2('x', 1, 2)";