Implement that entity as a database table with two subtypes

Assignment Help Database Management System
Reference no: EM134513

1) Start with CHECK_SALARY trigger explain below on triggers. Show that that trigger creates MUTTATING TABLE error. In order to circumvent that problem, write a combination of a BEFORE statement trigger and a modified BEFORE ROW trigger. Use the before statement trigger to record values of v_maxsalary and v_minsalary as packaged variables. In the row trigger perform the needed range check using those packaged variables. Add an AFTER statement trigger that would set those packaged variables to NULL, making it required for the BEFORE statement trigger to fire and act properly for the business rule to be enforced. Show that the above error is not raised. This is a standard way of eliminating mutating table errors.

MutatingTable:Example

SQL>CREATEOR REPLACETRIGGERcheck_salaryBEFOREINSERT OR UPDATEOFsal,job ONempFOREACH ROW

WHEN (new.job<> 'PRESIDENT') DECLARE

v_minsalaryemp.sal%TYPE;

vmaxsalaryemp.sal%TYPE;

BEGIN

SELECT MIN(sal),MAX(sal)

INTO   v_minsalary,v_maxsalary

FROM   emp

WHEREjob= :new.job;

IF:new.sal<v_minsalary OR

:new.sal>v_maxsalaryTHEN RAISE_APPLICATION_ERROR(-20505,

'Out of range');

;

END IF;

END;

SQL>UPDATEemp

SETsal=1500

WHEREename= 'SMITH';

*

ERRORatline2

ORA_4091:TableEMPismutating,trigger/functionmaynotseeit

ORA_06512:atline4                                   

ORA_04088:errorduringexecutionoftrigger'check_salary';

This trigger, CHECK_SALARY, tries to guarantee that whenever a new employee is added to the EMP table or an existing employee's salary or job title is changed, the employee's salary falls within the established salary range for the employee's job

2) Suppose Entity Title on slide below of Lecture note. Implement that entity as a database table with two subtypes, Games and Movie. Let both subtypes have their own unique ids, e.g. movie_id and game_id. Create another entity (table) Rented_Item that records rented items. Let that table reference movies and games from table (entity) Title. Implement the referential integrity using triggers. Populate both tables with various rows and shows that the referential integrity may be maintained.

Reference no: EM134513

Questions Cloud

What is current in the coil : What is current in the coil
How much current does an immersion heater draw from the car : How much current does an  immersion heater  draw from the car
What is diameter of the circle : What is diameter of the circle
Create a powerpoint presentation to show the solution : You will create a PowerPoint presentation to solution the questions below. Reminisce that your audience is the management of CBC: Ensure your presentation is professional and provides sufficient explanation.
Implement that entity as a database table with two subtypes : Implement that entity as a database table with two subtypes, Games and Movie.
What is lemmings kinetic energy : What is lemmings kinetic energy
How fast is the roller coaster moving at the top of the loop : How fast is the roller coaster moving at the top of the loop
Briefly define the current event described in the article : Research an article on a current event that centres on some sort of question or controversial issue. Then explain how you would analyze the situation if you were involved in this event to settle the issue Briefly define the current event describ..
Question on a planet similar to earth : Question on a  planet similar to Earth

Reviews

Write a Review

Database Management System Questions & Answers

  Create a database from scratch

Create a database from scratch that contains, at a minimum, the elements listed below

  Analysis of a simple case study

VSS has an existing software package that controls its high bay systems and wants to rewrite it. The existing system is written in C and uses C-ISAM files to store data.

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Database system development

The database application project (DAP) for this course consists of the creation of a fully functional Microsoft Access database application for a real client.

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Baxter aviation database

ER diagram for the Baxter Aviation database

  Creating database structure using sql

creating database structure using SQL

  Explain why data flow diagrams are developed in a hierarchy

Explain why data flow diagrams are developed in a hierarchy? What are the names of some levels in the hierarchy?

  Description of the relationship represented by scatterplot

Produce a scatterplot of Rent vs. Size (square meters of the apartment) for the rental data in rent.

  Draw the e/r diagrams for the business rules

Draw the E/R diagrams for the business rules

  Difference between obsolescent and redundant stocks

Difference between obsolescent and redundant stocks

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd