explain different types of jions with examples briefly?
Answer Posted / dinesh .
16)Join
Table1:Record
1 a
2 b
3 b
4 b
4 c
Table2:Record1
1 a 2
2 b 2
3 c 24
5 f 2
8 g 2
10 j NULL
Inner Join:
Qry1:select record_name,recordcount from record inner join
record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
qry2:select p.record_name,q.recordcount from record p,
record1 q where p.record_id=q.record_code
Result:
a 2
b 2
b 24
Left Join
qry3:select record_name,recordcount from record left join
record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
b NULL
c NULL
Right Join
qry4:select record_name,recordcount from record right join
record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
NULL 2
NULL 2
NULL NULL
Left Outer Join
qry5:select record_name,recordcount from record left outer
join record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
b NULL
c NULL
Right Outer Join
qry6:select record_name,recordcount from record right outer
join record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
NULL 2
NULL 2
NULL NULL
Full Outer Join
qry7:select record_name,recordcount from record full outer
join record1 on
record.record_id=record1.record_code
Result:
a 2
b 2
b 24
b NULL
c NULL
NULL 2
NULL 2
NULL NULL
"Their is No Left Inner Join,Right Inner Join in SQL Server
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is the difference between cube operator and rollup operator? : SQL Server Architecture
How to defragment indexes with alter index ... Reorganize?
What is provisioning, billing and metering, and connection routing concepts in the service layer?
What is tempdb database? : SQL Server Architecture
Write down the syntax and an example for create, rename and delete index?
Explain the relational database management system (rdbms)?
Explain few of the new features of sql server 2008 management studio
Is it possible to call a stored procedure within a stored procedure?
Explain the stored procedure?
What is Sqlpaging in SqlServer 2005 ?
Where sql server usernames and passwords are stored in a sql server?
What is trace flag in sql server?
How you can minimize the deadlock situation?
How do you run a trace?
What is the process of normalising?