Here's a query:
SELECT orders.order_date, orders.customer_numb
FROM orders INNER JOIN order_lines ON orders.order_numb = order_lines.order_numb
WHERE order_lines.isbn = '0-131-4966-9';
and here it is rewritten using a subquery:
SELECT order_date, customer_numb
WHERE order_numb IN (SELECT order_numb
WHERE isbn = '0-131-4966-9')
Assume that the tables orders and order_lines each have 500,000 rows/tuples.
Total no. of records in each table = 500,000
No. of groups of 100 rows in each table (since we read 100 rows at a time) = 500,000 / 100 = 5,000
(i) In the original query each record of first table has to be compared against every record of second table. ...
Apart from computing the number of hard drive reads in both the cases, solution briefly explains why/how these numbers are different.