data: employee salaries are 120000, 120000, 90000, 80000, 70000 (two people tie for the top)
== Q28: second highest salary ==
ORDER BY salary DESC OFFSET 1 (no DISTINCT) -> 120000   <- the tie makes this the top salary again
SELECT DISTINCT ... OFFSET 1                -> 90000
MAX(salary) WHERE salary < MAX(salary)      -> 90000
DENSE_RANK() = 2                            -> 90000
== Q29: duplicates ==
emails seen more than once:
  a@x.com x3
  b@x.com x2
DELETE ... NOT IN (SELECT MIN(id) ... GROUP BY email) removed 3 rows; left: [1, 2, 4]
== Q30: INNER vs LEFT JOIN, COUNT(*) vs COUNT(col), WHERE vs ON ==
departments (id 30 'Ops' has no employees)
INNER JOIN departments returned: 2   LEFT JOIN: 3
Ops: COUNT(*) = 1, COUNT(e.id) = 0   <- COUNT(*) counts the NULL-extended row
LEFT JOIN + WHERE e.salary > 100000 keeps 2 departments; the same filter in ON keeps 3
== Q31: what an index changes in the plan ==
without an index: SELECT     "PUBLIC"."BIG_SIGNUP"."ID",     "PUBLIC"."BIG_SIGNUP"."EMAIL" FROM "PUBLIC"."BIG_SIGNUP"     /* PUBLIC.BIG_SIGNUP.tableScan */ WHERE "EMAIL" = 'user777@x.com'
with idx_big_email: SELECT     "PUBLIC"."BIG_SIGNUP"."ID",     "PUBLIC"."BIG_SIGNUP"."EMAIL" FROM "PUBLIC"."BIG_SIGNUP"     /* PUBLIC.IDX_BIG_EMAIL: EMAIL = 'user777@x.com' */ WHERE "EMAIL" = 'user777@x.com'
