SQL CAST vs CONVERT: Safe Type Changes Across Databases
By Sharon Ben-Moshe · Aug 21, 2026
CAST turns one SQL data type into another. Learn when CONVERT differs, how invalid values fail, and how to write portable conversions.
Read postsqlfmt▍
sqlfmt blog
Practical posts on writing cleaner SQL and fixing the errors your database gives back.
By Sharon Ben-Moshe · Aug 21, 2026
CAST turns one SQL data type into another. Learn when CONVERT differs, how invalid values fail, and how to write portable conversions.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
DELETE removes selected rows, TRUNCATE empties a table, and DROP removes the table itself. Learn the crucial differences before running destructive SQL.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
Use SQL transactions to make related changes together. Learn COMMIT, ROLLBACK, SAVEPOINT, autocommit, and portable safety checks.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
A SQL CROSS JOIN returns every row combination from two inputs. Learn valid use cases, row-count math, safe formatting, and common mistakes.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
DISTINCT removes duplicate result rows; GROUP BY creates groups for aggregation. Learn the practical difference, examples, and common query mistakes.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
Concatenate SQL strings with || or CONCAT, but NULL behavior differs by database. See portable patterns for PostgreSQL, MySQL, SQL Server, and BigQuery.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
Use BigQuery UNNEST to flatten arrays into rows. Learn CROSS JOIN, LEFT JOIN, WITH OFFSET, aliases, and how to avoid duplicate surprises.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
Use PostgreSQL ILIKE for case-insensitive pattern matching. Learn wildcards, locale behavior, indexes, alternatives, and safer search examples.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
Use CASE inside SUM and COUNT to calculate several conditional metrics in one grouped SQL query. Learn the pattern, NULL behavior, and pitfalls.
Read postBy Sharon Ben-Moshe · Aug 21, 2026
INTERSECT returns shared query rows; EXCEPT returns rows in the first query but not the second. Learn set-operator rules, duplicates, and dialect caveats.
Read post