Skip to content

Dialect Differences

While “SQL” is a standard (ANSI SQL), every database vendor implements its own “flavor” or Dialect. It’s like English: you can understand someone from London, New York, and Sydney, but they use different words for the same thing (e.g., Elevator vs. Lift).

  1. PostgreSQL: The most standard-compliant and feature-rich open-source database.
  2. SQL Server (T-SQL): Microsoft’s enterprise database, known for great tooling and window function support.
  3. MySQL: The world’s most popular open-source database, known for speed and simplicity.
  • Postgres/MySQL: SELECT * FROM table LIMIT 10;
  • SQL Server: SELECT TOP 10 * FROM table;
  • Oracle: SELECT * FROM table FETCH FIRST 10 ROWS ONLY;
  • Postgres: FirstName || ' ' || LastName
  • SQL Server: FirstName + ' ' + LastName
  • MySQL: CONCAT(FirstName, ' ', LastName)
  • Postgres: Table and column names are case-insensitive unless quoted ("MyTable"). Data is case-sensitive by default.
  • SQL Server: Usually case-insensitive for both names and data (depending on the “Collation” settings).
  • MySQL: Table names are case-sensitive on Linux but insensitive on Windows. Data is insensitive by default.
FeaturePostgreSQLSQL ServerMySQL
Recursive CTEsYesYesYes (since v8.0)
JSON SupportExcellent (JSONB)GoodGood
Window FunctionsExcellentExcellentGood
Full Outer JoinYesYesNo (Must use Union)
Materialized ViewsYesYes (Indexed Views)No

A common task is “Update if the row exists, otherwise Insert.” This is a classic dialect nightmare.

  • Postgres: INSERT INTO ... ON CONFLICT (id) DO UPDATE SET ...
  • SQL Server: MERGE INTO ... WHEN MATCHED THEN UPDATE ... WHEN NOT MATCHED THEN INSERT ...
  • MySQL: INSERT INTO ... ON DUPLICATE KEY UPDATE ...

When you switch between databases, your code doesn’t just change syntax; it changes how it talks to the server.

  • Postgres uses the libpq protocol.
  • SQL Server uses TDS (Tabular Data Stream).
  • MySQL uses its own binary protocol.

This is why you need different “Database Drivers” (like psycopg2 for Postgres or pyodbc for SQL Server) in your programming language.

If you need…Look at…
Flexible dataJSONB columns
Complex sequencesGaps and Islands logic
Reusable logicStored Procedures
Cross-platform codeANSI SQL Standards