Week 3 Assignment For IT332 Database Management
Week 3 Assignment For IT332 Database Management
Chapter 6
1. Using the descriptions of the attributes given in the figure, convert the ERD shown in Figure P6.1 into
a dependency diagram that is in at least 3NF.
WEEK 3 ASSIGNMENT – FIGGINS 2
2. Using the descriptions of the attributes given in the figure, convert the ERD shown in Figure P6.2 into
a dependency diagram that is in at least 3NF.
WEEK 3 ASSIGNMENT – FIGGINS 3
4. Using the STUDENT table structure shown in Table P6.4, do the following:
a. Write the relational schema and draw its dependency diagram. Identify all dependencies, including all
transitive dependencies.
b. Write the relational schema and draw the dependency diagram to meet the 3NF requirements to the
greatest practical extent possible. If you believe that practical considerations dictate using a 2NF
structure, explain why your decision to retain 2NF is appropriate. If necessary, add or modify attributes to
create appropriate determinants and to adhere to the naming conventions.
Chapter 7
1. Write the SQL code required to list the employee number, last name, first name, and middle initial
of all employees whose last names start with Smith. In other words, the rows for both Smith and
Smithfield should be included in the listing. Sort the results by employee number. Assume case
sensitivity.
3. Write the SQL code that will produce the same information that was shown in Problem 2, but
sorted by the employee’s last name.
4. Write the SQL code that will list only the distinct project numbers in the ASSIGNMENT table,
sorted by project number.
WEEK 3 ASSIGNMENT – FIGGINS 5
6. 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, sorted by
employee number. The results of running that query are shown in Figure P7.6.
7. Write a query to produce the total number of hours and charges for each of the projects represented
in the ASSIGNMENT table, sorted by project number. The output is shown in Figure P7.7.
8. 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.8.
WEEK 3 ASSIGNMENT – FIGGINS 6
11. Generate a listing of all purchases made by the customers, using the output shown in Figure P7.11
as your guide. Sort the results by customer code, invoice number, and product description.
12. Using the output shown in Figure P7.12 as your guide, generate a list of customer purchases,
including the subtotals for each of the invoice line numbers. The subtotal is a derived attribute
calculated by multiplying LINE_UNITS by LINE_PRICE. Sort the output by customer code, invoice
number, and product description. Be certain to use the column aliases as shown in the figure.
WEEK 3 ASSIGNMENT – FIGGINS 8
18. Write a query to produce the number of invoices and the total purchase amounts by customer,
using the output shown in Figure P7.18 as your guide. Note the results are sorted by customer code.
(Compare this summary to the results shown in Problem 17.)
19. Write a query to generate the total number of invoices, the invoice total for all of the invoices, the
smallest of the customer purchase amounts, the largest of the customer purchase amounts, and the
average of all the customer purchase amounts. Your output must match Figure P7.19.
20. List the balances of customers who have made purchases during the current invoice cycle—that
is, for the customers who appear in the INVOICE table. The results of this query are shown in Figure
P7.20, sorted by customer code.
21. Provide a summary of customer balance characteristics for customers who made purchases.
Include the minimum balance, maximum balance, and average balance, as shown in Figure P7.21.
WEEK 3 ASSIGNMENT – FIGGINS 9
Additional Questions
1. Suppose that someone tells you that an attribute that is part of a composite primary key is also a
candidate key. How would you respond to that statement?
It's always valid for an attribute within a composite primary key to also be a candidate key by itself. It
simply means that the chosen attribute (or combination) has the potential to uniquely identify records on
its own, but for reasons of data integrity or design choices, it's included in a composite key for a more
robust unique identifier.
2. From your perspective, what are the principal advantages of SQL?
SQL is specifically designed for working with relational databases, where data is organized in a structured
and tabular format with well-defined relationships between tables. Because of this, data retrieval,
manipulation, and analysis is very easy. It resembles natural language to some extent, making it easier to
learn and write queries, especially for simple operations like data retrieval.
3. What is the difference between a column constraint and a table constraint?
4. Select 3 web links from W3: Useful Web Links and write a brief paragraph about your findings.