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 recursive stored procedure in sql server?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
Tell me what is use of except clause? How it differs from not in clause?
what method you can use to reduce the overhead of Reporting Services data sources?
What are the purposes of floor and sign functions?
What is key attribute?
What are click through reports?
After removing a table from database, what other related objects have to be dropped explicitly?
what is a correlated sub-query? : Sql server database administration
What is blocking and how would you troubleshoot it? : sql server database administration
What is the difference between cartesian product and cross join?
What is row_number()?
Which tcl commands are available on the sql server?
define and explain the differences between clustered and non-clustered indexes.
Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?