|
SQL Inner Join keyword will return the records if there is at least one match in both tables.
Table Name ‘Users’
|
U_Id
|
FirstName
|
LastName
|
City
|
|
1
|
Ajay
|
senha
|
New York
|
|
2
|
Vinda
|
kapoor
|
Los Angeles
|
|
3
|
Qasim
|
bilal
|
New York
|
In this table U_Id is primary key.
Table Name ‘UserCourses’
|
Uc_id
|
CourseNo
|
U_Id
|
|
1
|
34190
|
1
|
|
2
|
34192
|
1
|
|
3
|
34190
|
2
|
SELECT Users.U_Id, Users.FirstName, Users.FirstName, UserCourses.CourseNo
FROM Users
INNER JOIN UserCourses
ON Users.U_Id=UserCourses.U_Id
|
U_Id
|
FirstName
|
LastName
|
CourseNo
|
|
1
|
Ajay
|
senha
|
34190
|
|
1
|
Ajay
|
senha
|
34192
|
|
2
|
Vinda
|
kapoor
|
34190
|
|