Beruflich Dokumente
Kultur Dokumente
EMPLOYEE
EmployeeNo FName LName ZipCode
CUSTOMER
CustomerNo FName LName ZipCode
ORDER
OrderNo DateReceipt DateExpected DateShipped EmployeeNo CustomerNo
PART
PartNo Name Price QuantityInStock
ORDER_CONSISTS
OrderNo PartNo Quantity
Question 02 [1+1+1+1+1 points]: Suppose that each of the following update operation is applied independently to
the database shown in Figure 5.6. If the update is a valid one (ignore the syntax errors if there is any), just write
“Valid”, otherwise, indicates it is “Invalid” and explicitly indicate why it is invalid based on all the constraints you
have studied so far. (SET NULL is the default option for delete). (CLO2)
a) Insert < 'Robert', 'F', 'Scott', '66622', '1941-06-42', '2365 Newcastle Rd, Bellaire, TX', M, 58000,
'888665555', 1 > into EMPLOYEE.
ANSWER:
INVALID: Violate SSN Domain Constraint
c) Modify the MGRSSN and MGRSTARTDATE of the DEPARTMENT tuple with DNUMBER=2 to
'123456789' and '2011-10-17', respectively.
ANSWER:
INVALID, DNUMBER=2 is not existed
d) Modify the SUPERSSN attribute of the EMPLOYEE tuple with SSN= '999887777' to 888665555'.
ANSWER:
VALID
e) Modify the HOURS attribute of the WORKS_ON tuple with ESSN= '999887777' and PNO= 10 to '5.0'.
ANSWER:
VALID
Question 04 [2+2+2+2 points]: Consider the database shown in the figure 5.6. Write down the queries to perform
the following operation in basic SQL Syntax. (You can use any SQL operation but syntax should be correct)
(CLO3)
a) Retrieve the names of all employees in department 5 who work more than 10 hours on the ‘ProductX’
project.
SELECT LNAME, FNAME
FROM EMPLOYEE, WORKS_ON, PROJECT
WHERE DNO=5 AND SSN=ESSN AND PNO=PNUMBER AND PNAME='ProductX' AND
HOURS>10
b) For each department that has more than five employees, retrieve the department number and the
number of its employees who are making more than $40,000.
c) Retrieve the names of all employees who work in the department that has the employee with the
highest salary among all employees.
d) Create a view that has the employee name, supervisor name, and employee salary for each employee
who works in the ‘Research’ department.
Question 5 [2+2+2 points]: Consider a database with the following schema: (CLO4)
) )
b) Find the names of all females who eat either mushroom or pepperoni pizza (or both).
c) Find all ShopNames that serve at least one pizza that ‘Amy’ eats for less than $10.00.
) ))