# Midterm Notes

Know the following:

1. Understand the relationship between a disk’s seek time, rotational latency, transfer rate, buffer size and file size when reading a file from disk.
2. How to write simple to complex SQL statements as applied to this database. It contains five related tables.
1. Find menu items costing between \$7 and \$10.
```SELECT MID,mName,price
WHERE price>=7 AND price<=10```
2. Compute Ron Wong’s bill (from his order items) including tax.
```SELECT SUM(qty*price) AS tab, SUM(qty*price)*0.04712 AS tax,
SUM(qty*price)+SUM(qty*price)*0.04712 AS total
WHERE OID=2```
3. How much did Ron Wong’s order cost the restaurant in ingredients?
Intermediate – list every ingredient including unit quantity (uQty), unit price (price) and number of units (qty):

```SELECT *, qty*uQty*unitCost AS qqCost
WHERE OID=2```

Final – sum the unit quantity times the unit price times the number of units to one number:

```SELECT SUM(qty*uQty*unitCost) AS TOT_qqCost
```SELECT customerName, SUM(qty*uQty*unitCost) AS TOT_qqCost
1. Find menu items costing between \$7 and \$10.``` π MID,mName,price ( σ price≥7 AND price≤10 ( MI ) )```
`S(MID,mName,price) ← MI(MID,mName,price) AND price≥7 AND price≤10`