SlideShare a Scribd company logo
1 of 2
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;
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;

More Related Content

More from jandrewsxu

Modulation schemes 8
Modulation schemes 8Modulation schemes 8
Modulation schemes 8jandrewsxu
 
Modulation techniques 7
Modulation techniques 7Modulation techniques 7
Modulation techniques 7jandrewsxu
 
Bluetooth wi fi wi max 2, 3
Bluetooth wi fi wi max 2, 3Bluetooth wi fi wi max 2, 3
Bluetooth wi fi wi max 2, 3jandrewsxu
 
Acsg 520 assignment #6 ---
Acsg 520   assignment #6 ---Acsg 520   assignment #6 ---
Acsg 520 assignment #6 ---jandrewsxu
 
Acsg 520 assignment #4 --
Acsg 520 assignment #4  --Acsg 520 assignment #4  --
Acsg 520 assignment #4 --jandrewsxu
 
First hw assignment #1 --
First hw assignment #1  --First hw assignment #1  --
First hw assignment #1 --jandrewsxu
 
Assumptions, applicable measures, er diagram
Assumptions, applicable measures, er diagramAssumptions, applicable measures, er diagram
Assumptions, applicable measures, er diagramjandrewsxu
 
Data dictionary
Data dictionaryData dictionary
Data dictionaryjandrewsxu
 
Assumptions, and applicable measures
Assumptions, and applicable measuresAssumptions, and applicable measures
Assumptions, and applicable measuresjandrewsxu
 
Final presentation(v5)
Final presentation(v5)Final presentation(v5)
Final presentation(v5)jandrewsxu
 
Essay #2 ethical considerations
Essay #2   ethical considerationsEssay #2   ethical considerations
Essay #2 ethical considerationsjandrewsxu
 
Midterm paper medical records
Midterm paper   medical recordsMidterm paper   medical records
Midterm paper medical recordsjandrewsxu
 
Essay #2 ethical considerations
Essay #2   ethical considerationsEssay #2   ethical considerations
Essay #2 ethical considerationsjandrewsxu
 
Essay #1 analzying google's censorship
Essay #1   analzying google's censorshipEssay #1   analzying google's censorship
Essay #1 analzying google's censorshipjandrewsxu
 
Chapter 11 group assignment
Chapter 11 group assignmentChapter 11 group assignment
Chapter 11 group assignmentjandrewsxu
 
Chapter 8 group assignment
Chapter 8 group assignmentChapter 8 group assignment
Chapter 8 group assignmentjandrewsxu
 
Chapter 7 task 2 (of group assignment)
Chapter 7 task 2 (of group assignment)Chapter 7 task 2 (of group assignment)
Chapter 7 task 2 (of group assignment)jandrewsxu
 
Chapter 4 group assignment
Chapter 4 group assignmentChapter 4 group assignment
Chapter 4 group assignmentjandrewsxu
 

More from jandrewsxu (19)

Modulation schemes 8
Modulation schemes 8Modulation schemes 8
Modulation schemes 8
 
Modulation techniques 7
Modulation techniques 7Modulation techniques 7
Modulation techniques 7
 
Bluetooth wi fi wi max 2, 3
Bluetooth wi fi wi max 2, 3Bluetooth wi fi wi max 2, 3
Bluetooth wi fi wi max 2, 3
 
Acsg 520 assignment #6 ---
Acsg 520   assignment #6 ---Acsg 520   assignment #6 ---
Acsg 520 assignment #6 ---
 
Acsg 520 assignment #4 --
Acsg 520 assignment #4  --Acsg 520 assignment #4  --
Acsg 520 assignment #4 --
 
First hw assignment #1 --
First hw assignment #1  --First hw assignment #1  --
First hw assignment #1 --
 
Journal
JournalJournal
Journal
 
Assumptions, applicable measures, er diagram
Assumptions, applicable measures, er diagramAssumptions, applicable measures, er diagram
Assumptions, applicable measures, er diagram
 
Data dictionary
Data dictionaryData dictionary
Data dictionary
 
Assumptions, and applicable measures
Assumptions, and applicable measuresAssumptions, and applicable measures
Assumptions, and applicable measures
 
Final presentation(v5)
Final presentation(v5)Final presentation(v5)
Final presentation(v5)
 
Essay #2 ethical considerations
Essay #2   ethical considerationsEssay #2   ethical considerations
Essay #2 ethical considerations
 
Midterm paper medical records
Midterm paper   medical recordsMidterm paper   medical records
Midterm paper medical records
 
Essay #2 ethical considerations
Essay #2   ethical considerationsEssay #2   ethical considerations
Essay #2 ethical considerations
 
Essay #1 analzying google's censorship
Essay #1   analzying google's censorshipEssay #1   analzying google's censorship
Essay #1 analzying google's censorship
 
Chapter 11 group assignment
Chapter 11 group assignmentChapter 11 group assignment
Chapter 11 group assignment
 
Chapter 8 group assignment
Chapter 8 group assignmentChapter 8 group assignment
Chapter 8 group assignment
 
Chapter 7 task 2 (of group assignment)
Chapter 7 task 2 (of group assignment)Chapter 7 task 2 (of group assignment)
Chapter 7 task 2 (of group assignment)
 
Chapter 4 group assignment
Chapter 4 group assignmentChapter 4 group assignment
Chapter 4 group assignment
 

Database chapter 11 homework

  • 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;