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


Please Help Members By Posting Answers For Below Questions

Why do we backup Active Directory ?

613


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

558


What is fill factor and pad index?

542


can any body tell me how to know the password of current user in sql server

1581


What number sorts of privileges are accessible in sql?

600






What is extended stored procedures?

571


What are the new features are introduced in sql server 2012 reporting services?

108


What are the types of processing and explain each? : sql server analysis services, ssas

739


What do you mean by collation recursive stored procedure?

593


What does indexation mean?

531


How much is a sql server license?

510


What are views in ms sql server?

600


What is bit data type?

626


What is Lock table in SQL?

1005


how would you write a sql query to compute a frequency table of a certain attribute involving two joins? What changes would you need to make if you want to order by or group by some attribute? What would you do to account for nulls?

1101