Question
This is database. Solve question 2 using either standard SQL or Oracle. Please write clearly and explain your solution where needed. Salaried_worker (name, office, phone,
This is database. Solve question 2 using either standard SQL or Oracle. Please write clearly and explain your solution where needed.
Salaried_worker (name, office, phone, salary)
Hourly_worker (name, hourly_wage)
Address (name, street, city)
1. Create an SQL assertion that ensures that every name that appears in the relation address appears in either salaried_worker or hourly_worker, but not necessarily in both.
my answer is following, is it right???
create assertion worker check
(not exists (select name
from salaried_worker
where name not in (select name, from bourly_worker)));
2. Suppose you are given a relation emp(empid, dept, salary) and wish to maintain a materialized view deptsalary(dept, totalsalary) which stores the total salary for all employees of each department. Suppose the system does not support materialized views but supports triggers. Write an SQL or Oracle trigger on insert on emp to keep the relation deptsalary up to date. Do not worry about deletes or updates. You can assume that there is already a tuple for each department in deptsalary so you do not need to worry about new deparments. (Note: if you solve this question using Oracle, do not create a view for deptsalary, just create a table for it.)
The question 2, I do not know, I cannot get it. I need help!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started