Hello,
It is Interview Quetion,I am joing 5 tables,if query is too long,what i have to do,what are the other option?
Printable View
Hello,
It is Interview Quetion,I am joing 5 tables,if query is too long,what i have to do,what are the other option?
other option is to use subquery for example
select * from table1 where col1 in (select col1 from table2 where col2 in (.................))))
----V V----
Vikas Vaidya
(Please mark the quote as thanks if u found the answer useful)
Then go for coralated sub query...its give better performance also....
Hello,
Your question is not clear. From what I understood and will do
1. First check how many rows are there in the individual tables that need to be joined.
2. Then note down the foreign key columns.
3. Get the data in to temporary table(s) by joining 2 tables at a time which will be easy when writing the final query to output the result set.
Hope this helps.
Thanks
Hi Nithya !! Jameel here,
You can go for views as views are compiled select statements and can span across multiple tables
Hai,
It is very much better to use the sub queries.
If we use the views it is nested upto 32 levels only..
If it crossed you may get errors.
use the views to simplify tasks
views is the best solution for this.....