r/SQL • • May 20 '26

PostgreSQL What are common SQL red flags?

Hello! interview prepping, here wondering what are some common red flags for wrioting SQL?

Like

LIKE failing to index, not having trasnactions, usign SELECT * instead of specific collums, etc 😃

51 Upvotes

192 comments sorted by

View all comments

Show parent comment

8

u/Ventus_004 May 21 '26

In case you are ever asked to elaborate, this is how I describe it to people:

It's nice to have INNER to specify without a doubt the behavior that will occur - especially for folks who are new to SQL or new to your codebase. This way, you're describing the join in a way that is not ambiguous.

For the LEFT JOIN, there's no such thing as a LEFT INNER JOIN or any other type of LEFT JOIN, so you're communicating what type of join it is perfectly sufficiently without specifying OUTER.

Putting those together, you're always specifying the join type in a consistent way - "{TYPE} JOIN".

If you had a craving for specific type of dessert, you would say "I want a chocolate cake" (INNER JOIN) or "I want an ice cream cake" (LEFT JOIN), not "I want a cake" (JOIN) or "I want an ice cream cake that is made with ice cream" (LEFT OUTER JOIN).