May 2020
Beginner
564 pages
14h 9m
English
You can also use the WHERE clause along with the GROUP BY clause. The GROUP BY clause will go after the WHERE clause like so:
USE lahmansbaseballdb;SELECT playerid, teamid FROM battingWHERE playerid = 'aardsda01'GROUP BY teamid, playerid;
The previous query returns the results shown in the following screenshot:

Here, you can see that you are now only getting the results for aardsda01.
As a comparison, if you execute the previous query without GROUP BY, the query will return one additional row:
USE lahmansbaseballdb;SELECT playerid, teamidFROM battingWHERE playerid = 'aardsda01';
The following screenshot shows the ...
Read now
Unlock full access