Join 3 tables (table1, table2 & table3) in a single query.
Inner join should be applied for table1 & table 2 and left
outer join for table1 & table3 where table2.dept is ABC
Answer Posted / sumit m.
Although the above answer is correct. I am preferring
paranthesis in the answer, something like below:
There are 2 forms of the query for the answer:
SELECT *
FROM (table t1 INNER JOIN table2 t2 ON t1.col = t2.col AND
t2.dept = 'ABC')
LEFT JOIN table t3 ON t1.col = t3.col
OR
SELECT *
FROM (table t1 INNER JOIN (SELECT * FROM table2 WHERE dept
= 'ABC') t2 ON t1.col = t2.col)
LEFT JOIN table t3 ON t1.col = t3.col
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is SQL Azure Data sync?
What is etl - extraction, transformation, and loading?
What is log in sql server?
Explain how many normalization forms?
What is stored procedures?
What are the types of database schema? : sql server analysis services, ssas
What does normalization do to data?
What are difference between Cluster index and Non-Cluster index?
Call by value and call by reference in procedure and function, with NOCOPY.
Is a null value equal to anything? Can a space in a column be considered a null value? Why or why not?
what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?
what is the information that can be stored inside a bit column? : Sql server database administration
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
what are different types of backups available in sql server? : Sql server database administration
How to make a remote connection in a database?