1. Justin Andrews
ACSG 552
Chapter 11 Questions
4. High
5. Yes, due to the amount of dates possible. This is even more necessary when the dates
get more and more spastic, and also depends on the size of a given company.
6. Index Access (Unique), Index Scan (Range), and Sort.
7. Cost-based.
8. Table Scan (Full), Table Access (Row ID), Index Scan (Range), and Merge.
9. High
10. Yes, due to the variety prices can present, along with their likely ability to change at a
moment’s notice.
15. High for both, as there are countless values that could be offered depending on both
the product and point in time.
16. An index is not necessary as P_CODE works well enough as a primary key.
22. P_CODE and P.V_CODE indicate the use of a B-tree index, leading to the creation of
NDXP_CODE and NDXV_CODE.
23. CREATE INDEX NDXP_CODE ON P(P_CODE);
CREATE INDEX NDXV_CODE ON V(P.V_CODE);
24. EXPLAIN PLAN FOR SELECT P_CODE, P_DESCRIPT, P_PRICE,
P.V_CODE, V_STATE
FROM PRODUCT P, VENDOR V
WHERE P.V_CODE = V.V_CODE
AND V_STATE = ‘NY’
AND V_AREACODE = ‘212
ORDER BY P_PRICE;
27. SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE
FROM PRODUCT
WHERE P_QOH < 50
ORDER BY P_QOH;
2. 28. I would recommend a B-tree index with the indexes being NDXP_CODE and
NDXV_CODE.
CREATE INDEX NDXP_CODE ON PRODUCT(P_CODE);
CREATE INDEX NDXV_CODE ON PRODUCT(V_CODE);
29. Not to overuse derived attributes, and to consider alternate options.
30. SELECT CUS_CODE, INV_NUM, MAX(LINE_UNITS*LINE_PRICE)
FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN
LINE
WHERE CUS_AREACODE = ‘615’
GROUP BY CUS_CODE;
31. A B-tree index using newly created indexes NDX_CUS and NDX_INV.
CREATE INDEX NDX_CUS ON CUSTOMER(CUS_CODE);
CREATE INDEX NDX_INV ON INVOICE(INV_NUM);
32. Excluding the derived attributes would be the best way to ensure the indexes are
used.
SELECT CUS_CODE, INV_NUM, LINE_UNITS, LINE_PRICE,
FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN
LINE
WHERE CUS_AREACODE = ‘615’
GROUP BY CUS_CODE;