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

What is a join in sql? What are the types of joins?

687


What is an etl file?

699


What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas

724


What are different types of database indexes?

687


What does it mean to be in union?

673






What are the difference between “where” and “having” clause in sql server?

747


Why I am getting this error when renaming a database in ms sql server?

724


Explain index in sql server?

754


what are the disadvantages of cursors? : Sql server database administration

681


How does stuff differ from the replace function?

738


How to provide default values to function parameters?

762


what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

683


What is triggers and its types?

725


What is the usage of the sign function?

703


What is sql sandbox in sql server?

824