Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions