Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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



What is the joins and how many types of Joins in sql server a diffrentiate ever one give a suaitab..

Answer / 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

What is the joins and how many types of Joins in sql server a diffrentiate ever one give a suaitab..

Answer / veeresh kethari

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

Post New Answer

More SQL Server Interview Questions

How to count groups returned with the group by clause in ms sql server?

0 Answers  


What are the advantages of using third-party tools?

0 Answers  


Difference Between varchar and nvarchar datatype?

3 Answers   Satyam,


What is cte (common table expression)?

0 Answers  


What is set nocount on and what is set nocount off?

0 Answers  






Restore database SQL2000, SQL2012 Backup of base is created in Microsoft SQL Server 2000 - 8.00.2066, I can't restore on Microsoft SQL Server 2012 - 11.0.2100.60

3 Answers   IT Decisions,


How to get a list of all tables with "sys.tables" view in ms sql server?

0 Answers  


can an order by clause be used in a creation of a view?

0 Answers  


I have a table in which phno is one of the columns.i do have some values in tht phno column.i need to update phno column values with 0(zero) as prefix.give me a correct solution plz...

7 Answers   Value Labs,


What are the differences between stored procedure and the dynamic sql?

0 Answers  


how to get rank of diffrent student in same table based on newly inserted row in sql server2008

4 Answers   ABC,


What command is used to create a database in the sql server and how?

0 Answers  


Categories