DA 512H - Databases Assignment 1: Ashok@iitg Chiranjib@iitg
DA 512H - Databases Assignment 1: Ashok@iitg Chiranjib@iitg
Assignment 1
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. Managers are not employees of any
department.
1. Print the name and the age of each employee who works in both Hardware and Software departments.
3. For each manager that is at most 40 years old, print its name and its salary.
4. Print the name of all managers that manage more than one department.
5. Print the name of all employees that work exactly in one department.
6. Print the name and the number of departments each employee works in.
7. For each department with more than 20 full-time-equivalent employees (i.e., where the part-time and
full-time employees add up to at least that many full-time employees), print the did together with the
number of employees that work in that department.
8. Find the ename of the manager who manages the department with the largest budget.
9. Find the ename of managers who manage only departments with budgets larger than $1 million, but
at least one department with budget less than $5 million.
1. Define a constraint on Emp that will ensure that every employee makes at least $10, 000. What kind
of constraint is it (attribute or table)?
page 1 of 2
Course Name November 13, 2023
2. What are the foreign-key constraints that can be specified on the schema. Give the SQL code that
specifies the constraints.
3. 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 maintain all the relevant integrity
constraints.
page 2 of 2