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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How you can move data or databases between servers and databases in sql server?

572


how to avoid cursors? : Sql server database administration

495


Which are the new data types introduced in sql server 2008?

516


What is fill factor and pad index?

551


List the ways in which dynamic sql can be executed?

647






How to create a Master database in SQL server ?

552


How to check table values in sql server?

538


Can we use pragma autonomous_transaction in trigger?

547


what is a sub-report?

96


What is reportserver and reportservertempdb ?

107


What are the requirements to use odbc connections in php scripts?

599


Explain what are the events recorded in a transaction log?

561


What are the filtered indexes?

605


What is co-related sub query?

570


How to disable a login name in ms sql server?

595