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

Why is replication required on the sql server?

566


Can sql servers linked to other servers like oracle?

536


What is difference between equi join and natural join?

530


What is user-defined functions? What are the types of user-defined functions that can be created?

555


What is instead of dml trigger?

579






What is transaction server implicit?

525


What are pessimistic lock and optimistic lock?

543


what is package and it uses and how can u call a package

1552


What is difference between createstatement and preparedstatement?

531


Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

516


What keyword you will use to get schema appended to the result set of a ‘for xml’ query?

585


What is partition in sql server?

520


Why we need sql server?

546


What is the difference between rank and dense_rank?

494


What is the difference between functions and stored procedures?

610