What is the joins and how many types of Joins in sql server
a diffrentiate ever one give a suaitable query
Answers were Sorted based on User's Feedback
/* 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 |
1.Inner join:All the matched records from the both tables.
2.Left outer join: All the matched records from the both
tables and unmatched records from the left table.
3.Right outer join:All the matched records from the both
tables and unmatched records from the right table.
4.Self join:Joining the table itself.
5.Cross join:Cross join will give u the Cartesian product
from the 2 tables,it won't allow 'where' clause.
Is This Answer Correct ? | 3 Yes | 1 No |
What are the steps to take to improve performance of a poor performing query? : sql server database administration
How to find the date and time of last updated table?
What is 2nf normalization?
Why use cursor in sql server?
Can we use where clause in union?
Thanks to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?
what is the difference between table and view
What is the maximum row of a size?
What is the exact numeric data type in sql?
What is SQL Profiler and the use of it?
Which is better statement or preparedstatement?
How you can get a list of all the table constraints in a database? : Sql server administration