Yurkol
Yurkol

Reputation: 1492

Need explanation with MySQL query

We have a MySQL database, which contains the table SportsTicker with following columns (as MySQL workbench shows):

'IDSportsTicker', 'int(11)', 'NO', 'PRI', NULL, ''
'SportsID', 'smallint(6)', 'NO', '', '1', ''
'HomeTeamID', 'int(11)', 'NO', '', NULL, ''
'ForeignTeamID', 'int(11)', 'NO', '', NULL, ''
'LeagueID', 'int(11)', 'NO', '', NULL, ''
'CoverageID', 'smallint(2)', 'NO', '', NULL, ''
'PlayStateID', 'smallint(2)', 'NO', '', NULL, ''
'StadiumID', 'int(11)', 'NO', '', NULL, ''
'dateTime', 'datetime', 'NO', '', NULL, ''
'neutralGround', 'bit(1)', 'NO', '', 'b\'0\'', ''
'scoutConfirmed', 'bit(1)', 'NO', '', NULL, ''
'booked', 'bit(1)', 'NO', '', 'b\'0\'', ''
'oddsAvailable', 'bit(1)', 'YES', '', 'b\'0\'', ''
'liveOddsAvailable', 'bit(1)', 'NO', '', 'b\'0\'', ''

And I have a query, which works:

SELECT ST.IDSportsTicker, ST.HomeTeamID, T.name as HomeTeamName, ST.ForeignTeamID, 
 AW.name as AwayTeamName, ST.LeagueID, L.name, ST.dateTime
FROM SportsTicker ST 
 JOIN Team T ON ST.HomeTeamID = T.IDTeam
 JOIN Team AW ON ST.ForeignTeamID = AW.IDTeam
 JOIN League L ON ST.LeagueID = L.IDLeague;

I am just curious, what all those 'ST.', 'T.', 'AW.' and other prefixes mean?

Thank you very much.

Upvotes: 0

Views: 45

Answers (2)

sameer kumar
sameer kumar

Reputation: 149

These are alias like nice name or temporary name which use to call the table in sort form.

Upvotes: 0

El Yobo
El Yobo

Reputation: 14966

They're aliases, a way of giving the table an alternate name in your query. You can see how they're defined in the FROM parameters of your query (e.g. FROM SportsTicker ST, where ST is the alias that the table is referred to elsewhere in your query).

Upvotes: 3

Related Questions