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 database black box testing?
What do you think of this implementation? Can this be implemented better?
How do triggers work?
Can I work with several databases simultaneously? : sql server management studio
Can we perform backup restore operation on tempdb? : sql server database administration
difference between Clustered index and non clustered index ?
What is failover clustering overview?
What are the differences between sql server and mysql.
What is the difference between cube operator and rollup operator? : SQL Server Architecture
Can you explain what are the restrictions applicable while creating views? : SQL Server Architecture
What are the authentication modes in sql server? How can it be changed?
Explain datetimeoffset data type in sal server 2008?
Can we return Data from 4(more than 1) tables in stored procedure?
How to delete duplicate rows from table except one?
What is database mirroring?