
Querying Arrays Inside JSONB With jsonb_array_elements
Search, count, filter and rebuild JSON arrays inside PostgreSQL JSONB, from containment tests to jsonb_array_elements, with timings for five tag lookups.
Everything you need to level up your coding skills.

Search, count, filter and rebuild JSON arrays inside PostgreSQL JSONB, from containment tests to jsonb_array_elements, with timings for five tag lookups.

Replace copied running-total formulas with SQL window functions: sums per group, moving averages, differences, ranks, and the tie trap in the default frame.

MySQL rejects a US date with error 1292 on a server load and stores a zero date on a LOCAL load. See both, the STR_TO_DATE fix, and how to find zero dates.

Build an XSD for an orders file step by step: sequence, pattern, enumeration, optional elements, required attributes and a decimal with attributes.

How a YAML tag makes PyYAML run code during load, a harmless demonstration, what changed in PyYAML 6 and the safe options for loading untrusted files.

Skip, reorder and compute columns in LOAD DATA with a column list, user variables and SET, plus the silent shift a short column list causes.

Translate INDEX and MATCH into SQL: one-way lookups, two-way table lookups, left-of-key lookups, match types and the join that replaces a lookup grid.

Build GIN indexes on JSONB, choose between jsonb_ops and jsonb_path_ops, and see the real size, build, insert and query costs on a 200,000-row table.

How to check XML files against an XSD: write the schema, run xmllint and lxml, read the errors, add Schematron for business rules, and test changes safely.

Skip a header with IGNORE 1 LINES, then handle doubled quotes, backslashes, embedded newlines and Windows line endings that LOAD DATA treats differently.

Rebuild an Excel pivot table in SQL with GROUP BY, conditional aggregation, ROLLUP and window percentages, and see what changes when columns are fixed.

Two switches control LOAD DATA LOCAL, one on the server and one on the client, each failing with its own error code. Enable both safely and know the risk.
We send one email when a new article is published. No spam.