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
Why do we backup Active Directory ?
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?
What is fill factor and pad index?
can any body tell me how to know the password of current user in sql server
What number sorts of privileges are accessible in sql?
What is extended stored procedures?
What are the new features are introduced in sql server 2012 reporting services?
What are the types of processing and explain each? : sql server analysis services, ssas
What do you mean by collation recursive stored procedure?
What does indexation mean?
How much is a sql server license?
What are views in ms sql server?
What is bit data type?
What is Lock table in SQL?
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?