Sunday, 20 November 2011


SQL JOINS are used whenever we have to select data from 2 or more tables. We can use same time two table whrere relationship between certain columns in these tables.

When the required data exit in one or more than one table at that time related table are joined using a join condition.
The Join condition combination combines a row in one table with a row in another table based on the same value with common attributes. Common attribute are the primary key assign in one table and a foreign key assign in related table.

There are Four type Joins:
Inner Join/Equi Join - The Inner Join/Equi Join is a join condition involving common attributes from two tables.
Outer Join - The Outer Join is a join condition in two table involving common attributes from two tables but table does not have a matching value in the other table, it is joined.
NoneEqui Join - The NoneEqui Join is a join condition in two table involving different attributes from two table. It is use to check condition and give a result.
Self Join - The Self Join is a join condition in table it self join in different attribute with in table.
Cross Join - The Cross Join is join condition involving Cartasian Product. A product results is not use where multitable query condition is use.
We have following "Student_Detail" name table:

S_NoS_NameTotalPercentage
1Jay50777.84
2Ajay48774.92
3Bhavesh46972.15
4Jaimin46371.23
5Dolar42565.38

We have following "Stu_Detail" name table:

Enrollment_NoS_NoS_Name
19210900941Jay
19210900642Ajay
19210900743Bhavesh
19210900924Jaimin
19210900875Dolar


Join Example

Syntax:
SELECT Table_Name1.Column_Name 
FROM Table_Name1,Table_Name2
WHERE Table_Name1.Column_Name=Table_Name2.Column_Name;
Example Statement:
SQL> SELECTStu_Detail.Enrollment_No 
FROM Stu_Detail,Student_Detail
WHERE Student_Detail.S_No=Stu_Detail.S_No;
Example Result:

Enrollment_NoS_No
19210900941
19210900642
19210900743
19210900924
19210900875
















SQL GUIDE

0 comments:

Post a Comment

TrainingHUB. Powered by Blogger.

Total Pageviews

THE BEST QTP TRAINING INSTITUTE IN HYDERABAD

QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page

TrainingHUB

Followers