Assertions
Assertions
Assertions
Exercise 1
Consider the following relational schema and briefly answer the questions
that follow:
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct time: integer)
Dept(did: integer, budget: real, managerid: integer)
1. Define a table constraint on Emp that will ensure that every employee makes at least
$10,000.
2. Define a table constraint on Dept that will ensure that all managers have age > 30.
3. Define an assertion on Dept that will ensure that all managers have age > 30. Compare
this assertion with the equivalent table constraint. Explain which is better.
4. Write SQL statements to delete all information about employees whose salaries
exceed that of the manager of one or more departments that they work in. Be sure to
ensure that all the relevant integrity constraints are satisfied after your updates.
1. Define a table constraint on Emp that will ensure that every employee
makes at least $10,000.