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...
Create the Database: The data is the same as was described in the ER Design Project...
Create the Database: The data is the same as was described in the ER Design Project assignment. In that assignment you were asked to map the ER diagram to relations in the database. Here is a formal description of the relations that you will use in this assignment: streamTV Database Relations shows(showID, title, premiere_year, network, creator, category) episode(showID, episodeID, airdate, title) showID is a foreign key to shows actor(actID, fname, lname) main_cast(showID, actorID, role) showID is a foreign key to...
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.
Discuss the content (type of data and files) of a database which could be useful at...
Discuss the content (type of data and files) of a database which could be useful at Accra Institute Technology(AIT).
Consider the below database schema for company ABC: Employee(empNo, givename, famname, gender, DOB) Supervises(super_empNo*, empNo*, description)...
Consider the below database schema for company ABC: Employee(empNo, givename, famname, gender, DOB) Supervises(super_empNo*, empNo*, description) Department(deptNo, name, manager_empNo*) Dependent(empNo*, name, relationship) Project(projNo, description, deptNo*) The relations Employee, Supervises, Department, Dependent and Project keep data for employees, supervision, departments, dependents of employees and projects of ABC. For the database, primary keys, and parent and child relations for foreign keys are annotated. The meaning of most attributes is self-explanatory. Answer questions below. Your answer to each question must be according to...
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT