Data Mgmt - 58 Chapter 5 Emp eid integer ename string age integer salary real Works eid integer did integer pct time integer Dept did integer

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 58 Chapter 5 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. Answer 5.7 The answers are given below: 1. Define a table constraint on Emp that will ensure that every employee makes at least $10,000 CREATE TABLE Emp ( eid INTEGER , ename CHAR(10) , age INTEGER , salary REAL , PRIMARY KEY (eid), CHECK ( salary > = 10000 )) 2. Define a table constraint on Dept that will ensure that all managers have age > 30 CREATE TABLE Dept ( did INTEGER , buget REAL , managerid INTEGER...
View Full Document

This note was uploaded on 01/17/2012 for the course EGN 4302 taught by Professor Dr.vishak during the Fall '12 term at University of Central Florida.

Page1 / 3

Data Mgmt - 58 Chapter 5 Emp eid integer ename string age integer salary real Works eid integer did integer pct time integer Dept did integer

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online