this post was submitted on 19 Nov 2025
450 points (93.1% liked)
Programmer Humor
28297 readers
946 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Personally I feel like SQL syntax is upside down, and things are used before they are defined.
I'd expect it to instead be like
Well, in this case
aandbare only aliases of table names, and it is assumed that tables were already "defined", i.e. they already exist. And aliases in my opinion are meant to shorten long table names, or give a name that will be more appropriate in the context of the query, considering more than tables names can be aliased, at least that's how I'm using them. But they still have to be descriptive enough so it's clear what kind of data we are working with without the need to look for what they are actually aliasing in advance. In your example if the table was namedusers_who_won_the_company_lottery(intentionally bad name) then aliasing it asusersor even aswinnerswill be nice, even necessary, and you do not have to ask "What the fuck iswinners?For me, although I have seen a lot of people do this in SQL in real scenarios, using
aandbin SQL is not a bad practice, it's a terrible practice. Feels like using them in function declarations in other programming languages, like doing a function declaration in C, at the top of the file like that:And letting whoever has to read the code after you go look at the definition and figure out by themselves what any of that is supposed to mean.
Or naming your variables
a,b,c, etc.Aliases are meant to improve readability imo, not worsen it.