{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Data Mgmt Lab_Part_20 - 58 Chapter 5 Emp(eid integer ename...

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

View Full Document Right Arrow Icon
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 , PRIMARY KEY (did), FOREIGN KEY (managerid) REFERENCES
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern