This is an important question in the interview now a days.
Typed data sets are pre defined datasets against normal one in the way of defining datatables, datarows and their relationships in a form of xsd file.
Sunday, February 28, 2010
Wednesday, February 24, 2010
Differences between subquery and correlated subquery
For example, using the northwind database, if you want to find out the price of all the books ordered, you can use a correlated subquery. Price information about each book is in the [Order Details] table, and the Orders table has all the books ordered.
SELECT O.OrderID, O.OrderDate,
(SELECT MAX (Od.UnitPrice) FROM [Order Details] AS Od
WHERE Od.OrderID = O.orderid) AS MaxUnitPrice
FROM Orders AS O
The subquery runs once for each row that the main query returns. This repeated access to the [Order Details] table could be inefficient. Generally, correlated subqueries can be re-written as a query using a join
Subscribe to:
Comments (Atom)