FROM HW1
Extra Credit 1
5.8.
Specify the following views in SQL on the COMPANY database schema
shown in Figure 3.5.
a. A view that has the department name, manager name, and manager
salary for every department.
b. A view that has the employee name, supervisor name, and employee
salary for each employee who works in the ‘Research’ department.
c. A view that has the project name, controlling department name, number
of employees, and total hours worked per week on the project for each
project.
d. A view that has the project name, controlling department name, number
of employees, and total hours worked per week on the project for each
project with more than one employee working on it.
15.28. Consider the relation R, which has attributes that hold schedules of courses
and sections at a university; R = {Course_no, Sec_no, Offering_dept,
Credit_hours, Course_level, Instructor_ssn, Semester, Year, Days_hours, Room_no,
No_of_students}. Suppose that the following functional dependencies hold
on R:
{Course_no} ? {Offering_dept, Credit_hours, Course_level}
{Course_no, Sec_no, Semester, Year} ? {Days_hours, Room_no,
No_of_students, Instructor_ssn}
{Room_no, Days_hours, Semester, Year} ? {Instructor_ssn, Course_no,
Sec_no}
Try to determine which sets of attributes form keys of R. How would you
normalize this relation?
Consider the following relations for an order-processing application database
at ABC, Inc.
ORDER (O#, Odate, Cust#, Total_amount)
ORDER_ITEM(O#, I#, Qty_ordered, Total_price, Discount%)
all figures u need u will find in the book
Assume that each item has a different discount. The Total_price refers to one
item, Odate is the date on which the order was placed, and the Total_amount is
the amount of the order. If we apply a natural join on the relations
ORDER_ITEM and ORDER in this database, what does the resulting relation
schema look like? What will be its key? Show the FDs in this resulting relation.
Is it in 2NF? Is it in 3NF? Why or why not? (State assumptions, if you
make any.)