by jkubicek · 2y ago · 0 comments
From this style guide, the aliases section would look like this in my style guide:
SELECT first_name
FROM staff
JOIN students
ON students.mentor_id = staff.staff_num;I'm not opposed to aliases, it's just no longer something I do by default.
Aliases are the SQL equivalent of ternary operators. Are you trying to write clean code or are you trying to express to other people you know things?
Also aliasing can be as much for legibility as anything.
SELECT
ZZ.first_name
FROM staff AS ZZ
INNER JOIN students AS Q ON Q.mentor_id = ZZ.staff_num; SELECT
staff.first_name
FROM staff
INNER JOIN students ON student.mentor_id = staff.staff_num;
Whether or not you agree on the exact number [0], humans have limited working memory and aliases that don't group up concepts use it up unnecessarily.[0] https://en.m.wikipedia.org/wiki/The_Magical_Number_Seven,_Pl...