sq11

Use the SQL INNER JOIN when you only want to return records where there is at least one row in both tables that match the join condition.

Example SQL statement

SELECT * FROM Individual
INNER JOIN Publisher
ON Individual.IndividualId = Publisher.IndividualId
WHERE Individual.IndividualId = '2';

Source Tables

Left Table
IndividualIdFirstNameLastNameUserName
1FredFlinstonefreddo
2HomerSimpsonhomey
3HomerBrownnotsofamous
4OzzyOzzbournesabbath
5HomerGainnoplacelike
Right Table
IndividualIdAccessLevel
1Administrator
2Contributor
3Contributor
4Contributor
10Administrator

Result

IndividualIdFirstNameLastNameUserNameIndividualIdAccessLevel
2HomerSimpsonhomey2Contributor
Next lesson covers the SQL OUTER JOIN.

No comments: