4 ms·
> If there is already a correlation with the same name then append a number. And then applies it for this query: SELECT first_name AS fn FROM staff AS s
by justinlardinois 10y ago
> If there is already a correlation with the same name then append a number.
And then applies it for this query:
SELECT first_name AS fn
FROM staff AS s1
JOIN students AS s2
ON s2.mentor_id = s1.staff_num;
I think that's terrible. s1 and s2 sound to me like they're instances of the same table that you had to JOIN with itself for some reason.
- deleted 10y ago[deleted]
- developer2 10y agoAgreed, there is a lot I disagree with from the article, but this is the only one that my mind lashed out at as simply being WRONG. The only time I have seen numbers used on aliases in 10+ years is on self-joins. Even on self-joins I prefer to see something in the alias that identifies why that particular join is part of the query, but the reality is that such a descriptive name would often be so long that you're more likely to see a numeric suffix.