- MySQL – IF, CASE and Conditional Expressions
Branching inside a query. IF() for the two-way case, CASE WHEN for everything else, IFNULL() and NULLIF(), COALESCE() for the first non-NULL of several, and the pattern that makes CASE genuinely useful — conditional aggregation, counting completed and cancelled orders in a single pass instead of running two queries.
- MySQL – LIMIT and Pagination
LIMIT, LIMIT with OFFSET, and why LIMIT without ORDER BY is a bug waiting to happen. Then the part most tutorials skip: OFFSET pagination gets slower the deeper you page, because the server still has to walk and discard every row it skips — and what keyset (seek) pagination does instead.
- Designing a URL Shortener
The classic warm-up question, worked properly. Requirements and estimates, base62 encoding against hash-and-truncate, how to handle collisions without a retry loop that never terminates, the 301-versus-302 decision that also decides whether you get analytics, the read path and its cache, custom aliases, and expiry that does not require scanning the table.
- MySQL – ORDER BY
Sorting results. ASC and DESC, sorting by several columns, sorting by an expression or an alias, where NULLs land in MySQL and how to force them to the other end, sorting by a column you did not select, and why a query without ORDER BY has no guaranteed order at all — even when it looks sorted every time you run it.
- LeetCode 36 – Valid Sudoku
No algorithm at all — a bookkeeping problem. Rows, columns and all nine boxes can be checked in a single pass, and the only interesting line is the formula mapping a cell to its box: (row / 3) * 3 + col / 3. Encoding three facts per cell into one set, why valid is not the same as solvable, and the bitmask version for when you are asked to drop the hashing.