May 2020
Beginner
564 pages
14h 9m
English
Table aliases allow you to assign a different name to a table in your query. As you can see from the queries in the previous section, the naming of columns for joined tables can get long and make your query hard to read. This is where table aliases come in. You can use an alias for your tables in the join and make it easier to read and reference which table your columns belong to. Taking a query from the previous section and putting on aliases, you get the following query:
SELECT p.playerid, birthyear, a.yearid, a.teamid, G_defense, H FROM lahmansbaseballdb.appearances AS aINNER JOIN lahmansbaseballdb.people AS pON p.playerid = a.playeridINNER JOIN lahmansbaseballdb.batting AS bON p.playerid = b.playerid ...
Read now
Unlock full access