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

  Creating database structure using sql

creating database structure using SQL

  Pharmacy designating database

Pharmacy systems today are more efficient and user friendly when compared to the systems 20 years ago.

  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.

  Create a database using oracle packaged procedure

Create a database using Oracle packaged procedure

  Study and modify the postgresql source code

Write a Assignment to study and modify the PostgreSQL source code, with a focus on one of the core modules - the buffer manager

  Practice on topic of normalization

Practice on topic of Normalization

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Explain the datawarehouse and data mining concepts

There are six major types of information systems which organisations use in their operations. Discuss how these information systems support managers in their decision making role Explain the datawarehouse and data mining concepts using appropria..

  Show the rea diagram using microsoft word

Show the REA diagram using Microsoft Word

  Prepare the relational schema for database

Prepare the relational schema for database

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