SQL Function & Dialect Crosswalk
The same query intent, spelled differently across MySQL, PostgreSQL, and SQL Server — with the caveats that a simple keyword swap would miss.
- MySQL
IFNULL()PostgreSQL PostgreSQL's COALESCE() covers everything MySQL's IFNULL() does for the common 2-argument case, and goes further by accepting any number of fallback expressions. - MySQL
GROUP_CONCAT()PostgreSQL PostgreSQL's STRING_AGG() does the same job as MySQL's GROUP_CONCAT(), but makes the separator mandatory and moves ORDER BY to a different position in the call. - MySQL
DATE_FORMAT()PostgreSQL DATE_FORMAT() and TO_CHAR() both work for grouping and display in PostgreSQL, but neither lets a plain index satisfy a query that filters or groups by the formatted string — the query-shape implications matter more than the syntax swap. - MySQL
DATEDIFF()PostgreSQL PostgreSQL has no DATEDIFF() function — subtracting two date values directly returns the same whole-day integer that MySQL's DATEDIFF() does. - MySQL
AUTO_INCREMENTPostgreSQL PostgreSQL's SQL-standard GENERATED ALWAYS AS IDENTITY columns replace MySQL's AUTO_INCREMENT, but back the counter with a distinct sequence object and reject explicit-value inserts by default. - MySQL
LIMIT ... OFFSET ...SQL Server SQL Server 2012+'s OFFSET/FETCH clause covers what MySQL's LIMIT does, but requires an explicit ORDER BY, and older SQL Server versions need a completely different ROW_NUMBER()-based rewrite. - SQL Server
TOPPostgreSQL PostgreSQL's LIMIT covers SQL Server's basic TOP N case exactly, but TOP's PERCENT and WITH TIES variants need a genuinely different query shape, not a keyword swap. - PostgreSQL
STRING_AGG()MySQL MySQL's GROUP_CONCAT() does the same job as PostgreSQL's STRING_AGG(), but makes the separator optional and applies a silent output-length cap PostgreSQL doesn't have.