Question: 1) Given an ER diagram (as shown below), write SQL statements to create the corresponding relations and capture as many of the constraints as possible.

1) Given an ER diagram (as shown below), write SQL statements to create the corresponding relations and capture as many of the constraints as possible. If you cannot capture some constraints, explain why.

1) Given an ER diagram (as shown below), write SQL statements to

2) Suppose that we have a ternary relationship R between entity sets A, B, and C such that (i) A has a key constraint and total participation; and (ii) C has a key constraint. These are the only constraints. A has attributes a1 and a2, with a1 being the key; B has attributes b1 and b2, with b1 being the key; and C has attributes C1 and C2, with C1 being the key. R has no descriptive attributes. All of the above-mentioned attributes are to be stored as Strings of 10 characters. Write SQL statements that create tables corresponding to this information so as to capture as many of the constraints as possible. If you cannot capture some constraint, explain why.

3)Answer each of the following questions briefly. The questions are based on the following relational schema: Emp(eid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pcttime: integer) Dept(did: integer, dname: string, budget: real, managerid: integer) a. Give an example of a foreign key constraint that involves the Dept relation. What are the options for enforcing this constraint when a user attempts to delete a Dept tuple? b. Define the Dept relation in SQL so that every department is guaranteed to have a manager. c. Write an SQL statement to add John Doe as an employee with eid = 101, age = 32 and salary = 15, 000. d. Write an SQL statement to give every employee a 10 percent raise.

salary dname phone dno budget Employees ' ManagesMADepartments Works in Dependent Child name age

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!