May 2020
Beginner
564 pages
14h 9m
English
You can execute the following query using a correlated subquery in the SELECT clause:
USE lahmansbaseballdb; SELECT f.playerid, f.yearid, f.teamid, pos, (SELECT salary FROM salaries s WHERE (f.playerid = s.playerid AND f.teamid = s.teamid AND f.yearid = s.yearid)) AS salaryFROM fielding fORDER BY f.playerid;
The previous query returns the same results as the previous query in this section did, as shown in the following screenshot:

The previous query will return the playerid, yearid, teamid, pos, and salary columns. salary is obtained by querying the salaries table and joining it to the ...
Read now
Unlock full access