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

What is the meaning of resultset type_scroll_insensitive?

0 Answers  


What is an Index?

3 Answers   Yardi Software,


What happens when transaction log is full?

0 Answers  


How to provide default values to stored procedure parameters?

0 Answers  


 Explain what is sql override for a source taLle in a mapping?

0 Answers   Informatica,






Explain the different index configurations a table can have?

0 Answers  


What is the difference between ‘having’ clause and a ‘where’ clause?

0 Answers  


statement (of account) Receive ID_receive Date_receive Amount_receive TO_receive From_receive Description_receive 1 2010/01/01 500 Bank Ahmed Payment from the account 2 2010/02/01 700 Bank Ahmed Payment from the account Payment ID_payment Date_payment Amount_payment From_payment To_payment Description_payment 1 2010/03/01 1000 Ahmed Sales Sale goods 2 2010/04/01 1500 Ahmed Sales Sale goods How can crate Stored Procedures for the statement (of account) from these tables? I want statement (of account) like this: (in sql 2005) ID_ name description debit account credit account balance

1 Answers  


What is difference between commit and rollback when used in transactions?

0 Answers  


What is the difference between count and distinct count?

0 Answers  


How do you measure the performance of a stored procedure?

3 Answers   Infosys,


difference between Clustered index and non clustered index ?

0 Answers   Infosys,


Categories