Question
Consider the following relational schema. An employee can work in more than one department; the pct time field of the Works relation shows the percentage
Consider the following relational schema. An employee can work in more than one department; the
pct time field of the Works relation shows the percentage of time that a given employee works in a given department.
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct time: integer)
Dept(did: integer, budget: real, managerid: integer)
Write SQL integrity constraints (domain, key, foreign key, or CHECK constraints; or assertions) or SQL triggers to ensure each of the following requirements, considered independently.
1. A manager must always have a higher salary than any employee that he or she manages.
2. Whenever an employee is given a raise, the managers salary must be increased to be at least as much.
3. Whenever an employee is given a raise, the managers salary must be increased to be at least as much. Further, whenever an employee is given a raise, the departments budget must be increased to be greater than the sum of salaries of all employees in the department.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started