Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve question 1 using standard SQL. Solve question 2 using standard SQL. Please write clearly and explain your solution where needed. 1. Suppose you are

Solve question 1 using standard SQL. Solve question 2 using standard SQL. Please write clearly and explain your solution where needed.

1. 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

2. Consider the database given:

salaried worker (name, office, phone, salary) hourly worker (name, hourly wage) address (name, street, city)

. 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

4. Are my sources relevant?

Answered: 1 week ago