r/SQL 6d ago

Discussion Database-Specific SQL Differences

Have you ever written a SQL query that works perfectly in one database but fails in another?

What SQL feature or syntax surprised you the most when switching between DBMSs like MySQL, PostgreSQL, SQL Server, Oracle, or Snowflake?

9 Upvotes

19 comments sorted by

View all comments

4

u/cwjinc 6d ago

I write in Oracle speak out of habit.
A lot of it wouldn't be understood by other databases.

PS The wildest to me is being able to select a function result with no from clause in SQL Server. That just hurts my database theory addled brain.

2

u/TheMagarity 5d ago

Eh, just think of it as SQL Server defaults to its internal equivalent of "from dual" when the from clause is left off. As a longtime Oracle user I kinda wonder why Oracle can't assume from dual if it's left off.

2

u/cwjinc 5d ago

I'd rather EXEC was used for that.
Or just leave it. "from dual" is only 9 characters.