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...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE...
A database schema consisting of three relations STUDENT, COURSE, and STAFF is created as follows: CREATE TABLE STUDENT (STU_ID CHAR(4), STUDENT_NAME CHAR(20), ADDRESS CHAR(20), BIRTHDATE DATE, GENDER CHAR(6)); CREATE TABLE COURSE (COURSE_ID CHAR(6), COURSE_TITLE CHAR(20), STAFF_ID CHAR(3), SECTION NUMBER(2)); CREATE TABLE STAFF (STAFF_ID CHAR(3), STAFF_NAME CHAR(20), GENDER CHAR(6), DEPARTMENT CHAR(20), BOSS_ID CHAR(3) SALARY NUMBER(8,2)); Write down SQL statement for each query below: 1) Find out the information of staff members who are female and earn either below $5,000 or above...
Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-
Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-id, company-id, salary)             company(company-name, company-id, c-city)             manages(employee-id, manager-id) Specify the following queries on this database schema using the relational operators we discussed in class. Write your answers on a separate sheet of paper in the order that they are specified below. Retrieve the name and address of employees who work for First Bank Corporation. Retrieve the name, street address, and city of residence of all employees...
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.
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.
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.
Java Linked Lists I want a simple program that reads two text files that contains an...
Java Linked Lists I want a simple program that reads two text files that contains an integers matrix and store each file into a linked lists matrix so I can later preform operations such as addition and subtraction on the matrices an example of the input text files: sample a 2 6 2 6 2 18 17 11 20 sample b 3 13 5 4 11 20 13 18 20
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT