Question

In: Computer Science

Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:


Given the same simple Employee-Workson-Project database schema , which contains three files described as follows:

Emp (eid : integer, ename : string, age : integer, salary: real)

Workson (eid : integer, pid : integer, hours : integer)

Project (pid : integer, pname : string, budget : real, managerid : integer)

Note : eid, ename, age and salary are the employee id, name, age and salary respectively. Also, hours is the number of hours worked by employee on a project. The rest of the attributes pid, pname, budget and managerid are the project id, name, budget and managerid respectively. A manager is an employee.

Assume that an update is to be made to this database to enter information about a new project manager who is now the new manager of an existing project (replacing the old manager) and although he is new, he has worked some hours in another existing project. Answer the following questions on what specific relations, attributes and operations (eg. insert, modify, delete) that need to be done for this update to be implemented in the entire database.

Provide your answers both in descriptive sentences and using the formal database operations of INSERT, MODIFY, DELETE with specific attributes and relations when possible. An example formal insert of an employee record into the Emp table is:
INSERT < eid, ename, age, salary> into Emp; // for new Employee record

And an example descriptive sentence is:

i). do an insert operation for a new employee record into the Emp table.

(a) Give the set of needed insert, modify or delete operations for this update.

(b) What types of integrity constraints (explain using attributes, eg, eid of relevant files)) would you expect to check for this update to be done?

(c) Which of these integrity constraints are key, entity integrity, and referential (foreign key) integrity constraints and which are not?

(d) Specify all the referential integrity (foreign key) constraints on this database in the format Referring_Relation.Attribute --> Referred_Relation.Attribute

Solutions

Expert Solution

specified tables are with dummy values:

Emp:

eid ename age salary
1 ram 25 10000
2 raju 26 20000
3 titu 27 15000


workson

eid pid hours
1 10 20
2 1 10
3 2 25

Project

pid pname budget managerid
1 abc 10000 2
2 cde 20000 3

as per the given question:

We need to update new project manager for the existing project. So , Let's update project with pid=1

and managerid=2 to pid=1 and managerid=1

to do this following is the sql query:

update project set managerid=1 where pid=1;

resulting changes will be as follow: project table

pid pname budget managerid
1 abc 10000 1
2 cde 20000 3

similar change is required in workson table since it holds number of hours of work done by emp. to do the same following is the sql querry:

update workson set pid=1 where eid=1;

=> update pid column in workson table where eid=1.

resultant table: workson table

eid pid hours
1 1 20
2 1 10
3 2 25

b) integrity constraints : in these given table eid from emp table will be the primary key and managerid will be the foreign key referring emp table in project table and this intigrity constraint will be checked for the update to be done.

c) entity integrity: is the mechanism provided to maintain the primary keys of the table. so in our case primary key is eid from emp table and pid from project table.

referential integrity: mechanism to maintain foreign keys of the table.In out example : managerid from project table and eid and pid from workson table are foreign keys

d) referential integrity (foreign key) constraints on this database :=

Project.managerid-->emp.eid

workson.pid-->project.pid

workson.eid--> emp.eid


Related Solutions

The schema for the Academics database is as follows. Understanding this schema is necessary to answer...
The schema for the Academics database is as follows. Understanding this schema is necessary to answer the questions in Part B. DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) The semantics of most attributes are self-explanatory. For each relation, the primary key is underlined and any foreign keys are denoted by an asterisk (*). Some additional information for relations is given below: DEPARTMENT: Each academic department...
Discuss the three-schema architecture and its benefits for database development and design.
Discuss the three-schema architecture and its benefits for database development and design.
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name,...
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name, price, quantity) transaction(trans_id, cust_id, time_date) product_trans(product_id, trans_id) Identify the primary keys and foreign keys for the relations and specify at least two different types of integrity constraints that would be applicable for different relations given.
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such...
Given the directory /home/Kitty which contains the files timer.exe and bags.txt. Set the protection but such that; Give the commands that would change the permissions. It will be a Linux system Only the owner Kitty can execute timer.exe. Kitty’s default group can write to the directory, but no one can delete or move any file except Kitty.
A company has three project alternatives as follows. Project                        A         &nbsp
A company has three project alternatives as follows. Project                        A                                B                                 C First Cost                    $39,000                       $20,000                       $31,000 Salvage Value             $2,000                         $4,000                         $6,000 Annual Maintenance   $1,200                        $1,600                         $800 Annual Income           $18,800                       $14,400                       $16,200 Useful Life (years)      6                                  3                                  5 a.       Utilize the present worth analysis to help the company to select the best project assuming that these projects are mutually exclusive and the interest rate is 10%? b.      Utilize...
A cubical tank has sides of 4.5m which contains three immiscible liquids at same depths. A...
A cubical tank has sides of 4.5m which contains three immiscible liquids at same depths. A water upto a height of 1.5m above the base, An immiscible liquid of specific gravity 0.9 is filled in between both liquids (mid-portion) upto 1.5m height, the upper remaining part is filled with oil of specific gravity 0.79. Calculate (i) The value of pressures at the top, at the interface points and at bottom on one side of the tank (ii) The position of...
1. These three terms all refer to the same part of a database: True or False...
1. These three terms all refer to the same part of a database: True or False Instance Row Field 2. When compared to File Processing systems, select each of the following that are advantages of a database system. Note: there may be more than one right answer. Group of answer choices; A. Shorter development times. B. If the data structure changes, a program may not need to be changed. C. The data does not need to be duplicated. D. There...
You have been given the following specifications for a simple database about the requests for software...
You have been given the following specifications for a simple database about the requests for software that staff members make for their units (note that primary keys are shown underlined, foreign keys in bold). You should run your SQL to demonstrate that it works correctly, and paste in the statements used plus the output from Oracle. LAB (RoomNo, Capacity) SOFTWARE (SoftwareID, SoftwareName, Version) REQUEST (SoftwareID, RoomNo, RequestDate, TeachingPeriod, Progress) Based on the table specifications provided, answer the following questions. Each...
Write a Java class called Employee (Parts of the code is given below), which has three...
Write a Java class called Employee (Parts of the code is given below), which has three private fields firstName (String), lastName (String) and yearsEmployed (double). Implement accessor/mutator methods for the private fields and toString() method, that returns a String representation, which contains employee name and years she was employed. public class Employee { private String firstName; ... } Write a client program called EmployeeClient that creates an instance of Employee class, sets values for the fields (name: John Doe, yearsEmployed:...
Consider the database of a car rental company that contains three tables drivers, cars and reservation...
Consider the database of a car rental company that contains three tables drivers, cars and reservation tables. Drivers:                                           Reservation:                              Cars: Dno Dname age Dno Cno Day Cno Cmake Color 22 Dustin 45 22 101 10/10 101 BMW Blue 29 Brutus 33 22 102 10/10 102 VW Red 31 Lubber 55 22 103 10/8 103 OPEL Green 32 Andy 25 22 104 10/7 104 FIAT Red 58 Rusty 35 31 102 11/10 64 Horatio 35 31 103 11/6 71 Zorba...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT