Is table aliasing a bad practice?
28
votes
7
answers
8132
views
I remember learning to do this in a DBMS course for Master of Information Services students. To save yourself some typing, you can type:
SELECT t1.id, t2.stuff
FROM
someTable t1
INNER JOIN otherTable t2
ON t1.id=t2.id
;
But... Why is this acceptable in stored procedures and such? It seems like all it does is harm the readability of the statement while saving an extremely minor amount of time. Is there any functional or logical reason to do this? It seems to add ambiguity rather than remove it; the only acceptable reason I can see for using this format is if you were adding a semantically meaningful alias -- for example,
FROM someTable idsTable
-- when the table name isn't descriptive enough.
Is table aliasing a bad practice or is this just a misuse of a helpful system?
Asked by Zelda
(2103 rep)
Sep 20, 2011, 02:17 PM
Last activity: May 15, 2024, 08:04 AM
Last activity: May 15, 2024, 08:04 AM