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
What is a join in sql? What are the types of joins?
What is an etl file?
What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas
What are different types of database indexes?
What does it mean to be in union?
What are the difference between “where” and “having” clause in sql server?
Why I am getting this error when renaming a database in ms sql server?
Explain index in sql server?
what are the disadvantages of cursors? : Sql server database administration
How does stuff differ from the replace function?
How to provide default values to function parameters?
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
What is triggers and its types?
What is the usage of the sign function?
What is sql sandbox in sql server?