May 2020
Beginner
564 pages
14h 9m
English
An intersect allows you to combine two or more results sets that contain the distinct values of each set. The following screenshot shows you what results from an intersect:

MySQL doesn't support the INTERSECT SQL operator, but there is a workaround with a join. This can be done with DISTINCT and INNER JOIN. The following query shows you how to do this:
SELECT DISTINCT a.playeridFROM lahmansbaseballdb.batting bINNER JOIN lahmansbaseballdb.appearances aON a.playerid = b.playeridORDER BY a.playerid;
The previous query gives you the results shown in the following screenshot: ...
Read now
Unlock full access