Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Using the given table, answer the questions (operable on mysql ) Write a trigger to create a default department location in Houston every time new

Using the given table, answer the questions (operable on mysql )

  1. Write a trigger to create a default department location in Houston every time new department is inserted into database.
  2. Write a trigger to enforce following constraint: employee salary must not be higher than the salary of his/her direct supervisor. If it is, then display message Supervisee salary is higher than supervisor salary.
  3. Write a trigger to update supervisor SSN of an employee with the SSN of the department manager where he/she works BEFORE INSERT(ing) the record into employee table IF the supervisor SSN attribute is empty or NULL.
  4. Create a view that displays first name, last name, SSN, salary, department name and department number for each department manager.
  5. Create a view that displays project number, project name, controlling department number, controlling department name, total number of employees, total salary paid, and total hours worked for each project.image text in transcribed

Pno Pnumber WORKS ON Essn 123456789 123456789 Hours 32.5 Dnum 5 7.5 2 EMPLOYEE Frame Minit John B Franklin T Alicia Jennifer S Ramesh K Joyce | A Ahmad V 12 3 Lname Ssn Bdate Address Sex Salary Super_ssn Dno Smith 123456789 1965-01-09 731 Fondren, Houston, TX M 30000 333445555 Wong 333445555 1955-12-08 638 Voss, Houston, TX M 40000 8886655555 Zelaya 999887777 1968-01-19 3321 Castle, Spring, TXF 25000 9876543214 Wallace 987654321 1941-06-20 291 Berry, Bellaire, TX F 43000 888665555 4 Narayan 666884444 1962-09-15 975 Fire Oak, Humble, TX M 38000 3334455555 English 453453453 1972-07-31 5631 Rice, Houston, TXF 25000 3334455555 Jabbar 987987987 1969-03-29 980 Dallas, Houston, TXM 25000 987654321 | 4 Borg 888665555 1937-11-10 450 Stone, Houston, TXM 55000 NULL PROJECT Pname ProductX ProductY Productz Computerization Reorganization Newbenefits 666884444 453453453 453453453 333445555 Plocation Bellaire Sugarland Houston Stafford Houston Stafford 40.0 20.0 20.0 10.0 10.0 10.0 10 20 30 2 2 3 10 20 James DEPENDENT 10.0 Essn Sex DEPARTMENT 30 30.0 333445555 Dname | Dnumber Mgr_ssn 10 10.0 M 333445555 333445555 333445555 333445555 333445555 999887777 999887777 987987987 987987987 987654321 987654321 888665555 333445555 Mgr_start_date 1988-05-22 1995-01-01 1981-06-19 Research Administration Headquarters DEPT_LOCATIONS Dnumber Dlocation Houston Stafford Bellaire Sugarland Houston Dependent_name Alice Theodore Joy Abner Michael Alice Elizabeth 987654321 10 30 30 20 20 Bdate 1986-04-05 1983-10-25 1958-05-03 1942-02-28 1988-01-04 1988-12-30 1967-05-05 35.0 5.0 20.0 15.0 NULL 987654321 Relationship Daughter Son Spouse Spouse Son Daughter Spouse 888665555 F M F F 123456789 123456789 123456789 | Pno Pnumber WORKS ON Essn 123456789 123456789 Hours 32.5 Dnum 5 7.5 2 EMPLOYEE Frame Minit John B Franklin T Alicia Jennifer S Ramesh K Joyce | A Ahmad V 12 3 Lname Ssn Bdate Address Sex Salary Super_ssn Dno Smith 123456789 1965-01-09 731 Fondren, Houston, TX M 30000 333445555 Wong 333445555 1955-12-08 638 Voss, Houston, TX M 40000 8886655555 Zelaya 999887777 1968-01-19 3321 Castle, Spring, TXF 25000 9876543214 Wallace 987654321 1941-06-20 291 Berry, Bellaire, TX F 43000 888665555 4 Narayan 666884444 1962-09-15 975 Fire Oak, Humble, TX M 38000 3334455555 English 453453453 1972-07-31 5631 Rice, Houston, TXF 25000 3334455555 Jabbar 987987987 1969-03-29 980 Dallas, Houston, TXM 25000 987654321 | 4 Borg 888665555 1937-11-10 450 Stone, Houston, TXM 55000 NULL PROJECT Pname ProductX ProductY Productz Computerization Reorganization Newbenefits 666884444 453453453 453453453 333445555 Plocation Bellaire Sugarland Houston Stafford Houston Stafford 40.0 20.0 20.0 10.0 10.0 10.0 10 20 30 2 2 3 10 20 James DEPENDENT 10.0 Essn Sex DEPARTMENT 30 30.0 333445555 Dname | Dnumber Mgr_ssn 10 10.0 M 333445555 333445555 333445555 333445555 333445555 999887777 999887777 987987987 987987987 987654321 987654321 888665555 333445555 Mgr_start_date 1988-05-22 1995-01-01 1981-06-19 Research Administration Headquarters DEPT_LOCATIONS Dnumber Dlocation Houston Stafford Bellaire Sugarland Houston Dependent_name Alice Theodore Joy Abner Michael Alice Elizabeth 987654321 10 30 30 20 20 Bdate 1986-04-05 1983-10-25 1958-05-03 1942-02-28 1988-01-04 1988-12-30 1967-05-05 35.0 5.0 20.0 15.0 NULL 987654321 Relationship Daughter Son Spouse Spouse Son Daughter Spouse 888665555 F M F F 123456789 123456789 123456789 |

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago