I have to display ten columns values from diffrent ten
tables.
how many joins are require?
Answer Posted / b.kumar
--MS SQL SERVER
WE CAN DISPLAY RECORDS BY USING 9 JOINS
SELECT TBL1.COLUMN1,TBL2.COLUMN2,---------,TBL10.COLUMN10
FROM TBL1 INNER JOIN TBL2 ON TBL1.ID=TBL2.ID
INNER JOIN TBL3 ON TBL1.ID=TBL3.ID
----
----
----
INNER JOIN TBL10 ON TBL1.ID=TBL10.ID
----------------------------------------
--WE CAN ALSO DISPLAY THE RECORDS WITH OUT USE JOINS
SELECT TBL1.COLUMN1,TBL2.COLUMN2,---------,TBL10.COLUMN10
FROM TBL1,TBLE2,--------,TBL10
WHERE TBL1.ID=TBL2.ID OR TBL1.ID=TBL3.ID OR
----
----
----
TBL1.ID=TBL10.ID
--WE MUST USE WHERE CLAUSE OTHER WISE WE GET Cartesian product.
--------------------------------------------------
WE CAN'T JOIN DIFFERENT TABLES OF COLUMNS BY USING UNION
BECAUSE UNION COMBINES THE TWO OR MORE RESULT SETS
(IT MEANS ROWS)
DIFFERENCE BETWEEN JOIN & UNION
-- JOIN COMBINES TWO OR MORE THE COLUMNS
-- UNION COMBINES TWO OR MORE ROWS
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what is bit datatype? : Sql server database administration
Why should one not prefix user stored procedures with ‘sp_’?
What are triggers in ms sql server?
What is normalization process?
How do you make a trace?
What is for xml in sql server?
application server is slow what may be the problem
How use inner join in sql server?
How except clause is differs from not in clause?
where can you add custom error messages to sql server? : Sql server administration
What’s the distinction between dropping a info and taking a info offline?
What do you understand by intent locks?
What is extent? Types of extents?
How many triggers are possible per table?
How to drop an existing schema in ms sql server?