1.99 See Answer

Question: The following data structure and constraints exist


The following data structure and constraints exist for a magazine publishing company.
a. The company publishes one regional magazine each in Florida (FL), South Carolina (SC), Georgia (GA), and Tennessee (TN).
b. The company has 300,000 customers (subscribers) distributed throughout the four states listed in Part 2a.
c. On the first of each month, an annual subscription INVOICE is printed and sent to each customer whose subscription is due for renewal. The INVOICE entity contains a REGION attribute to indicate the customer’s state of residence (FL, SC, GA, TN):

CUSTOMER (CUS_NUM, CUS_NAME, CUS_ADDRESS, CUS_CITY, CUS_STATE, CUS_ZIP,
CUS_SUBSDATE)
INVOICE (INV_NUM, INV_REGION, CUS_NUM, INV_DATE, INV_TOTAL)

The company is aware of the problems associated with centralized management and has decided that it is time to decentralize the management of the subscriptions in its four regional subsidiaries. Each subscription site will handle its own customer and invoice data. The management at company headquarters, however, will have access to customer and invoice data to generate annual reports and to issue ad hoc queries, such as:
• List all current customers by region.
• List all new customers by region.
• Report all invoices by customer and by region.
Given these requirements, how must you partition the database?


> Write the SQL code that will create the table structure for a table named EMP_1. This table is a subset of the EMPLOYEE table. The basic EMP_1 table structure is summarized in the table below. (Note that the JOB_CODE is the FK to JOB.) ATTRIBUTE (FIELD

> Write a query to display the author ID, first name, last name, and year of birth for all authors born in the decade of the 1980s (See Figure P7.79). FIGURE P7. 79 Authors Born in the 1980s AU ID AU FNAME AU LNAME AU BIRTHYEAR 218 Rachel Beatney Wals

> Write a query to display the book number, title, year of publication, subject, and cost for all books that are on the subjects of “Middleware” or “Cloud,” and that cost more than $70

> Write a query to display the book number, title, and year of publication of all books published after 2013 and on the “Programming” subject (See Figure P7.77). FIGURE P7. 77 Newer Books on Programming BOOK NUM BOO

> Write a query to display the checkout number, book number, and checkout date of all books checked out before April 5, 2015 (See Figure P7.76). FIGURE P7. 76 Checkouts before April 5th CHECK NUM BOOK NUM CHECK OUT DATE 91001 5235 3/31/2015 91002 523

> Write a query to display the book number, title, and year of publication for all books in the “Database” subject (See Figure P7.75). FIGURE P7. 75 Database Books BOOK NUM BOOK TITLE BOOK YEAR 5237 Mastering the da

> Write a query to display the book number, title, and year of publication for all books published in 2012 (See Figure P7.74). FIGURE P7. 74 Books Published in 2012 BOOK NUM BOOK_TITLE BOOK YEAR 5235 Beginner's Guide to JAVA 5236 Database in the Cloud

> Write a query to display the book title, year, and subject for every book. Sort the results by book subject in ascending order, year in descending order, and then title in ascending order (See Figure P7.73). FIGURE P7. 73 Books by Cascading Sort BO

> Write a query to display the checkout number, book number, patron ID, checkout date, and due date for every checkout that has ever occurred in the system. Sort the results by checkout date in descending order (See Figure P7.72). (68 rows) FIGURE P7. 72

> Write a query to display the book number, title, and cost of each book (See Figure P7.71). FIGURE P7. 71 Title and Replacement Cost for Books BOOK NUM ВОOK TITLE Replacement Cost 5235 Beginner's Guide to JAVA 5236 Database in the Cloud 59.95 79.95 5

> Generate a listing of all purchases made by the customers, using the output shown in Figure P7.28 as your guide. (Hint: Use the ORDER BY clause to order the resulting rows as shown in Figure P7.28) FIGURE P7.28 List of Customer Purchases CUS_CODE

> Write a query to display the different subjects on which FACT has books. Include each subject only once (See Figure P7.70). FIGURE P7. 70 Unique Book Subjects BOOK SUBJECT Cloud Database Middleware Programming

> Write a query to display the different years that books have been published in. Include each year only once (See Figure P7.69). FIGURE P7. 69 Unique Book Years BOOK YEAR 2012 2013 2014 2015

> Write a query to display the book number, book title, and year of publication for every book (See Figure P7.68). FIGURE P7. 68 Title and Year for all Books BOOK NUM TITLE Year Published 5235 Beginner's Guide to JAVA 2012 5236 Database in the Cloud 2

> Write the SQL code that will change the PROJ_NUM to 14 for those employees who were hired before January 1, 1994 and whose job code is at least 501. ATTRIBUTE (FIELD) NAME DATA DECLARATION  EMP_NUM CHAR(3)  EMP_LNAME VARCHAR(15)  EMP_FNAME VA

> Using a single command sequence, write the SQL code that will change the project number (PROJ_NUM) to 25 for all employees whose job classification (JOB_CODE) is 502 or higher. When you finish Problems 10 and 11, the EMP_2 table will contain the data sho

> Using a single command sequence, write the SQL code that will change the project number (PROJ_NUM) to 18 for all employees whose job classification (JOB_CODE) is 500. ATTRIBUTE (FIELD) NAME DATA DECLARATION  EMP_NUM CHAR(3)  EMP_LNAME VARCHAR(15)

> Write the SQL code to change the EMP_PCT value to 3.85 for the person whose employee number (EMP_NUM) is 103. Next, write the SQL command sequences to change the EMP_PCT values as shown in Figure P7.9. Figure P7.9 The contents of the EMP_2 table7 E

> Write the SQL code to create a copy of EMP_1, naming the copy EMP_2. Then write the SQL code that will add the attributes EMP_PCT and PROJ_NUM to its structure. The EMP_PCT is the bonus percentage to be paid to each employee. The new attribute characteri

> Write the SQL code that will restore the data to its original status; that is, the table should contain the data that existed before you made the changes in Problems 5 and 6. ATTRIBUTE (FIELD) NAME DATA DECLARATION  EMP_NUM CHAR(3)  EMP_LNAME VAR

> Write the SQL code to delete the row for the person named William Smithfield, who was hired on June 22, 2004, and whose job code classification is 500. (Hint: Use logical operators to include all of the information given in this problem. Remember, if you

> Write a query to count the number of customers with a customer balance over $500. FIGURE P7.26 THE CH07_SALECO DATABASE Relational Diagram Database name: Ch07_SaleCo CUSTOMER INVOICE LINE PRODUCT VENDOR 8 INV_NUMBER Y LINE_NUMBER 8 P_CODE P_DESCRIPT

> Create a sample XML document and DTD for the exchange of product and pricing data.

> Create a sample XML document and DTD for the exchange of customer data.

> Use MS Excel to list all classes taught in room KLR200 using the Ch02_TinyCollege System DSN.

> Create a System DSN ODBC connection called Ch02_TinyCollege using the Administrative Tools section of the Windows Control Panel.

> Use MS Excel to list all of the invoice lines for Invoice 1003 using the Ch02_SaleCo System DSN.

> Create a System DSN ODBC connection called Ch02_SaleCo using the Administrative Tools section of the Windows Control Panel.

> Use MS Excel to connect to the Ch02_InsureCo MS Access database using ODBC, and retrieve the customers whose AGENT_CODE is equal to 503.

> Use MS Excel to connect to the Ch02_InsureCo MS Access database using ODBC, and retrieve all of the CUSTOMERs.

> Create a sample XML document and DTD for the exchange of student transcript data. Use your college transcript as a sample.

> Create a sample XML document and DTD for the exchange of order data.

> Write a query to count the number of invoices. FIGURE P7.26 THE CH07_SALECO DATABASE Relational Diagram Database name: Ch07_SaleCo CUSTOMER INVOICE LINE PRODUCT VENDOR 8 INV_NUMBER Y LINE_NUMBER 8 P_CODE P_DESCRIPT Y CUS CODE 00 V INV_NUMBER CUs COD

> Use MS Excel to connect to the Ch02_InsureCo MS Access database using ODBC, and retrieve all of the AGENTs.

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the number of product sales (number of rows) and total sales by month, with subtotals by month and a grand total for all sales?

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the total sales by month and product category, with subtotals by month and a grand total for all sales?

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the total sales by region and customer, with subtotals by region and a grand total for all sales?

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem What is the SQL command to list the total sales by customer, month and product, with subtotals by customer and by month and a grand total for all product sales?

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the total sales by customer and by product, with subtotals by customer and a grand total for all product sales?

> ROBCOR, Inc., whose sample data are contained in the database named Ch13_P4.mdb, provides "on demand" aviation charters using a mix of different aircraft and aircraft types. Because ROBCOR has grown rapidly, its owner has hired you to be its first databa

> David Suker, the inventory manager for a marketing research company, wants to study the use of supplies within the different company departments. Suker has heard that his friend, Ephanor, has developed a spreadsheet-based data warehouse model that she us

> Victoria Ephanor manages a small product distribution company. Because the business is growing fast, Ephanor recognizes that it is time to manage the vast information pool to help guide the accelerating growth. Ephanor, who is familiar with spreadsheet s

> Create your own data analysis and visualization presentation. The purpose of this project is for you to search for a publicly available data set using the Internet and create your own presentation using what you have learned in this chapter. a. Search fo

> Write the SQL code to generate the total hours worked and the total charges made to all projects. The results should be the same as those shown in Figure P7.24. Figure P7.24 Total hours and charges, all employees SumOfSumOfASSIGN HOURS SumofSumOfA

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. Using the answer to Problem 10 as your base, what command would you need to generate the same output but with subtotals in all columns? (Hint: Use the CUBE command).

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the number of product sales (number of rows) and total sales by month, product category and product, with subtotals by month and product

> Using the data provided in the Ch13_SaleCo_DW database, solve the following problem. What is the SQL command to list the number of product sales (number of rows) and total sales by month and product category with subtotals by month and product category a

> The university computer lab's director keeps track of the lab usage, as measured by the number of students using the lab. This particular function is very important for budgeting purposes. The computer lab director assigns you the task of developing a da

> Given the scenario and the requirements in Problem 2, answer the following questions: a. What recommendations will you make regarding the type and characteristics of the required database system? b. What type of data fragmentation is needed for each tabl

> Figure P12.1 The DDBMS Scenario  Specify the minimum types of operations the database must support to perform the following operations. These operations should include remote request, remote transaction, distributed transaction, and distributed request

> Given the following query SELECT P_CODE, P_PRICE FROM PRODUCT WHERE P_PRICE >= (SELECT AVG(P_PRICE) FROM PRODUCT); What is the likely data sparsity of the P_PRICE column? Figure P11.7 The Ch11_SaleCo ER Model CUSTOMER INVOICE LINE INV NUMB

> Given the following query SELECT P_CODE, P_PRICE FROM PRODUCT WHERE P_PRICE >= (SELECT AVG(P_PRICE) FROM PRODUCT); What type of database I/O operations will likely be used by the query? (See Table 11.3.) Figure P11.7 The Ch11_SaleCo ER Model

> Given the following query SELECT P_CODE, P_PRICE FROM PRODUCT WHERE P_PRICE >= (SELECT AVG(P_PRICE) FROM PRODUCT); Assuming that there are no table statistics, what type of optimization will the DBMS use? Figure P11.7 The Ch11_SaleCo ER Model

> Write the SQL code to generate the total hours worked and the total charges made by all employees. The results are shown in Figure P7.24. (Hint: This is a nested query. If you use Microsoft Access, you can generate the result by using the query output s

> SELECT EMP_LNAME, EMP_FNAME, EMP_DOB, YEAR(EMP_DOB) AS YEAR FROM EMPLOYEE WHERE YEAR (EMP_DOB) = 1966; What type of database I/O operations will likely be used by the query? (See Table 11.3.)

> SELECT EMP_LNAME, EMP_FNAME, EMP_DOB, YEAR(EMP_DOB) AS YEAR FROM EMPLOYEE WHERE YEAR(EMP_DOB) = 1966; Should you create an index on EMP_DOB? Why or why not?

> SELECT EMP_LNAME, EMP_FNAME, EMP_DOB, YEAR(EMP_DOB) AS YEAR FROM EMPLOYEE WHERE YEAR (EMP_DOB) = 1966; What is the likely data sparsity of the EMP_DOB column?

> SELECT CUS_CODE, MAX(LINE_UNITS*LINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = ‘615’ GROUP BY CUS_CODE; How would you rewrite the query to ensure that the index you created in Problem 31 is used?

> SELECT CUS_CODE, MAX(LINE_UNITS*LINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = ‘615’ GROUP BY CUS_CODE; What indexes would you recommend for the query you wrote in Problem 30, and what SQL commands would you use?

> SELECT CUS_CODE, MAX(LINE_UNITS*LINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = ‘615’ GROUP BY CUS_CODE; Assuming that you follow the recommendations you gave in Problem 29, how would you rewrite the query?

> Using Table 11.4 as an example, create two alternative access plans. Use the following assumptions: a. There are 8,000 employees. b. There are 4,150 female employees. c. There are 370 employees in area code 615. d. There are 190 female employees in area

> SELECT CUS_CODE, MAX(LINE_UNITS*LINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = ‘615’ GROUP BY CUS_CODE; Assuming that you generate 15,000 invoices per month, what recommendation would you give the designer about th

> SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE P_QOH < P_MIN AND P_MIN = P_REORDER’ AND P_REORDER = 50; ORDER BY P_QOH; What indexes you would recommend? Write the commands to create those indexes.

> SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE P_QOH < P_MIN AND P_MIN = P_REORDER’ AND P_REORDER = 50; ORDER BY P_QOH; Use the recommendations given in Section 11-5b to rewrite the query to produce the required results more effi

> Write a query to produce the total number of hours and charges for each of the projects represented in the ASSIGNMENT table. The output is shown in Figure P7.23. Figure P7.23 Total hour and charges by project PROJ NUM SumOfASSIGN HOURS SumOfASSIGN C

> SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = ‘21344’ ORDER BY P_CODE; How should you rewrite the query to ensure that it uses the index you created in your solution to Problem 25?

> SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = ‘21344’ ORDER BY P_CODE; What index would you recommend, and what command would you use?

> SELECT P_CODE, P_DESCRIPT, P_PRICE, PRODUCT.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; Write the command(s) used to generate the statistics for the PRODUCT and VENDOR

> SELECT P_CODE, P_DESCRIPT, P_PRICE, PRODUCT.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; Write the commands required to create the indexes you recommended in Problem 22

> SELECT P_CODE, P_DESCRIPT, P_PRICE, PRODUCT.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; What indexes would you recommend?

> Assume that you have 10,000 different products stored in the PRODUCT table and that you are writing a Web-based interface to list all products with a quantity on hand (P_QOH) that is less than or equal to the minimum quantity, P_MIN. What optimizer hint

> Using Table 11.4 as an example, create two alternative access plans.

> SELECT EMP_LNAME, EMP_FNAME, EMP_AREACODE, EMP_SEX FROM EMPLOYEE WHERE EMP_SEX = ‘F’ AND EMP_AREACODE = ‘615’ ORDER BY EMP_LNAME, EMP_FNAME; What indexes should you create? Write the required SQL commands.

> SELECT V_CODE, V_NAME, V_CONTACT, V_STATE FROM VENDOR WHERE V_STATE = ‘TN’ ORDER BY V_NAME; What type of I/O database operations would be most likely to be used to execute that query?

> SELECT V_CODE, V_NAME, V_CONTACT, V_STATE FROM VENDOR WHERE V_STATE = ‘TN’ ORDER BY V_NAME; Assume that 10,000 vendors are distributed as shown in Table P11.18. What percentage of rows will be returned by the query? Table P11.18 Distribution of Vendors

> Using the data in the ASSIGNMENT table, write the SQL code that will yield the total number of hours worked for each employee and the total charges stemming from those hours worked. The results of running that query are shown in Figure P7.22. Figure P7.

> SELECT V_CODE, V_NAME, V_CONTACT, V_STATE FROM VENDOR WHERE V_STATE = ‘TN’ ORDER BY V_NAME; What indexes should you create and why? Write the SQL command to create the indexes.

> SELECT P_CODE, P_QOH*P_PRICE FROM PRODUCT WHERE P_QOH*P_PRICE > (SELECT AVG(P_QOH*P_PRICE) FROM PRODUCT) Should you create an index? If so, what would the index column(s) be, and why should you create that index?

> SELECT P_CODE, P_QOH*P_PRICE FROM PRODUCT WHERE P_QOH*P_PRICE > (SELECT AVG(P_QOH*P_PRICE) FROM PRODUCT) What is the likely data sparsity of the P_QOH and P_PRICE columns?

> SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM (LINE_UNITS) > (SELECT MAX(LINE_UNITS) FROM LINE); Write the command to create statistics for this table.

> SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM (LINE_UNITS) > (SELECT MAX(LINE_UNITS) FROM LINE); Should you create an index on P_CODE? If so, write the SQL command to create that index. If not, explain your reasoning.

> SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM (LINE_UNITS) > (SELECT MAX(LINE_UNITS) FROM LINE); Should you create an index? If so, what would the index column(s) be, and why would you create that index? If not, explain your reas

> SELECT P_CODE, SUM(LINE_UNITS) FROM LINE GROUP BY P_CODE HAVING SUM (LINE_UNITS) > (SELECT MAX(LINE_UNITS) FROM LINE); What is the likely data sparsity of the LINE_UNITS column?

> Given the following query SELECT P_CODE, P_PRICE FROM PRODUCT WHERE P_PRICE &gt;= (SELECT AVG(P_PRICE) FROM PRODUCT); Should you create an index? Why or why not? Figure P11.7 The Ch11_SaleCo ER Model CUSTOMER INVOICE LINE INV NUMBER %3 FK1 Cu

> SELECT EMP_LNAME, EMP_FNAME, EMP_AREACODE, EMP_SEX FROM EMPLOYEE WHERE EMP_SEX = ‘F’ AND EMP_AREACODE = ‘615’ ORDER BY EMP_LNAME, EMP_FNAME; What is the likely data sparsity of the EMP_SEX column?

> Assuming that pessimistic locking with the two-phase locking protocol is being used, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in P

> Write the SQL code to calculate the ASSIGN_CHARGE values in the ASSIGNMENT table in the Ch07_ConstructCo database. (See Figure P7.1.) Note that ASSIGN_CHARGE is a derived attribute that is calculated by multiplying ASSIGN_CHG_HR by ASSIGN_HOURS. Figure

> Assuming that pessimistic locking is being used, but the two-phase locking protocol is not, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction describ

> Create a simple transaction log (using the format shown in Table 10.13) to represent the actions of the two previous transactions.

> ABC Markets sell products to customers. The relational diagram shown in Figure P10.6 represents the main entities for ABC&acirc;&#128;&#153;s database. Note the following important characteristics: &acirc;&#128;&cent;A customer may make many purchases, e

> Suppose that your database system has failed. Describe the database recovery process and the use of deferred-write and write-through techniques.

> Using a simple example, explain the use of binary and shared/exclusive locks in a DBMS.

> What DBMS component is responsible for concurrency control? How is this feature used to resolve conflicts?

> Describe the three most common problems with concurrent transaction execution. Explain how concurrency control can be used to avoid those problems.

> Assuming that pessimistic locking with the two-phase locking protocol is being used, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in P

> Assuming that pessimistic locking is being used, but the two-phase locking protocol is not, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction describ

> Suppose you are a manufacturer of product ABC, which is composed of parts A, B, and C. Each time a new product is created, it must be added to the product inventory, using the PROD_QOH in a table named PRODUCT. And each time the product ABC is created, t

> Write the SQL code that will list only the distinct project numbers found in the EMP_2 table. Figure P7.9 The contents of the EMP_2 table EMP NUM EMP LNAME EMP_FNAME EMP_INITIAL EMP_HIREDATE JOB_CODE EMP_PCT PROJ_NUM 101 News John 08-Nov-00 502 5.0

> Starting with a consistent database state, trace the activities that are required to execute a set of transactions to produce an updated consistent database state.

> You have been assigned to design the database for a new soccer club. Indicate the most appropriate sequence of activities by labeling each of the following steps in the correct order. (For example, if you think that “Load the database” is the appropriate

1.99

See Answer