|
Tables in a database are often related to each other with keys. A primary key is a column which has a unique value for each record. It must be unique within the table. The purpose is to bind data together, across tables, without repeating all of the data in every table.
SQL Joins are used to relate information in different tables. A Join condition is a part of the sql query that retrieves rows from two or more 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
|
|