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


Please Help Members By Posting Answers For Below Questions

Why use triggers?

679


Explain user defined functions?

696


What happens when converting big values to integers?

664


How to manipulate data from one table to another table ?

627


How do I create a trace in sql server?

604






What is the difference between lock, block and deadlock? : sql server database administration

668


What does it mean to invest in the index?

606


how you can get the list of largest tables in a database? : Sql server administration

637


How you can get a list of all the table constraints in a database?

593


how to overcome kernel isssues

1269


What are trace flags?

673


Describe in brief authentication modes in sql server.

654


how you can list all the tables in a database?

631


Explain datetime2 data type in sal server 2008?

613


What do you understand by the denormalisation?

638