Use the bowling_league database. Select the BowlerLastName and BowlerFirstName as FirstBowler, BowlerZip, and BowlerLastName and BowlerFirstName as SecondBowler (all from Bowler table) where the two bowlers share the same BowlerZip and the BowlerLastName of the two bowlers are not equal. Limit to 6 results.
We can Join the table to itself. Self join is used to query hierarchical data or to compare a row with other rows within the same table.
We use Concat to combine First and last name under one header FirstBowler from
SELECT concat(A.BowlerLastName,' ', A.BowlerFirstName) as FirstBowler,
concat (B.BowlerZip,' ', B.BowlerLastName,' ', B.BowlerFirstName) as SecondBowler
FROM Bowler A
INNER JOIN Bowler B ON
A.BowlerZip = B.BowlerZip
AND
A.BowlerLastName = B.BowlerLastName
Get Answers For Free
Most questions answered within 1 hours.