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

Define left outer join in sql server joins?

710


What is the difference between function and stored procedure in sql server?

683


Difference between uniqe index and uniqe constraint?

718


How global temporary tables are represented and its scope?

722


List types of tables in SQL Azure?

120






How to override dml statements with triggers?

752


Difference between primary key and clustered index?

686


What do you mean by subquery?

750


What is serializable?

828


1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?

1839


Does partitioning help performance?

685


I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration

820


What is the difference between drop table and truncate table?

659


How do I partition a table in sql server?

718


What is a hint?

740