Do we need nested queries in the SQL?
September 20, 2012 9:55am CST
Hi, Most of the SQL programmers use nested queries as they are quite easy to learn. But implementation wise they are quite in-efficient. I tried to change some of the nested queries to simple queries. I succed in all cases. So my question is do we really need nested queries?
26 Sep 12
Hi, I have gone through both the links. These are nice tutorials for those who are begineers in query nesting. But they rarely talks about "Why and when subqueries may be necessary?" Although these links talks about "Nested queries can provide an extremely elegant method for solving complex problems." But this is not true for expert programmer as non-nested queries are more efficient in many situations. For example read the following discussion :- http://weblogs.sqlteam.com/jeffs/archive/2007/07/12/the-nested-where-in-sql-anti-pattern.aspx
15 Feb 13
It really depends on the occasion. But as a programmer, I must say that nested queries are really needed especially with complex table-relationship. It is inefficient if we cut the queries into smaller and simpler one to make it look easy but it is not. It will make the work slower and probably erroneous fetched data.