SQL Server

while using joins, Please remenber the keypoints,

1. use the primary key column and foreign key column of the table to create the join.
eg: EmpDeptID in Employee table with DeptID in Department table

2. the usage of other columns in the join will affect the performance of the query.

3. never use a variable in join condition, try to rewrite the same query with different join condition and use variable in the where.
eg: SELECT column1, colomn2 FROM Table1 T1 join Table2 T2
on T1.Col1 = T2.Col1 AND T1.Col2 = @Variable