What is the joins and how many types of Joins in sql server
a diffrentiate ever one give a suaitable query

Answers were Sorted based on User's Feedback



What is the joins and how many types of Joins in sql server a diffrentiate ever one give a suaitab..

Answer / kamal

/* INNER JOIN -- Matched Rows only from Tables */
SELECT NR.RequestId, U.UserId FROM ITWP_NewRequest NR

INNER JOIN ITWP_Users U ON U.UserId = NR.UserId

/* OUTER JOIN -- Matched Rows only from Tables
RIGHT OUTER JOIN -all the rows from Right table and matched
rows from Left Table.

LEFT OUTER JOIN - all the rows from Left table and matched
rows from Right Table.

FULL OUTER JOIN - all the rows from Left table and from
Right Table.
*/
SELECT NR.RequestId, U.UserId FROM ITWP_NewRequest NR

RIGHT OUTER JOIN ITWP_Users U ON U.UserId = NR.UserId

SELECT NR.RequestId, U.UserId FROM ITWP_NewRequest NR

LEFT OUTER JOIN ITWP_Users U ON U.UserId = NR.UserId

SELECT NR.RequestId, U.UserId FROM ITWP_NewRequest NR

FULL OUTER JOIN ITWP_Users U ON U.UserId = NR.UserId

/* A Join without having any condition is known
as Cross Join, in cross join every row in first table is
joins with every row in second table.
*/
SELECT NR.RequestId, U.UserId FROM ITWP_NewRequest NR

CROSS JOIN ITWP_Users U

Is This Answer Correct ?    4 Yes 0 No

What is the joins and how many types of Joins in sql server a diffrentiate ever one give a suaitab..

Answer / veeresh kethari

1.Inner join:All the matched records from the both tables.
2.Left outer join: All the matched records from the both
tables and unmatched records from the left table.
3.Right outer join:All the matched records from the both
tables and unmatched records from the right table.
4.Self join:Joining the table itself.
5.Cross join:Cross join will give u the Cartesian product
from the 2 tables,it won't allow 'where' clause.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More SQL Server Interview Questions

Why do we use non clustered index?

0 Answers  


Explain powershell included in sql server 2008?

0 Answers  


Does sql server 2000 full-text search support clustering?

0 Answers  


What is Sqlpaging in SqlServer 2005 ?

0 Answers   MCN Solutions,


Explain some DBCC commands?

6 Answers  






How you would rewrite the sql query to return the customerid sorted numerically?

0 Answers  


What is MSDE?

2 Answers  


How to fetch the next row from a cursor with a "fetch" statement?

0 Answers  


Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table?

5 Answers   eFunds,


what is the purpose of creating view is sql server 2000

13 Answers   Wipro,


What r sql reporting services and analysis services? how can we use it.

2 Answers   Microsoft,


How do I open port 1433?

0 Answers  


Categories