Ask PL-SQL Expert

Implement the following tasks using ORACLE SQL*Plus.

Download the file GHRSchema.sql from the LMS site and run it on ORACLE SQL*Plus. This file contains all the CREATE and INSERT statements you will need for this assignment.

To run the file, issue the following command: @D:\dbf\GHRSchema.sql

NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES.

The list of tables available for this assignment is the following:

CLIENT (ClientNo, Name, Sex, DOB, Address, Phone, Email, Occupation, MaritalStatus, Spouse, Anniversary)
CCONDITION (ClientNo, Condition)
RESERVATION (ResNo, ResDate, NoOfGuests, StartDate, EndDate,
ClientNo, Status)
ACTIVITY (ActivityID, ActName, ActDescription, ActRate, RiskLevel) OUTDOOR_ACTIVITY (ActivityID)
INDOOR_ACTIVITY (ActivityID, Location, OpeningHours) ACCOMMODATION (RoomNo, LevelNo, AccStatus, ConnectedRoomNo,
AccTypeID)
ACCOMMODATION_TYPE (AccTypeID, AccTypeName, AccTypeRate, NoOfBeds) EQUIPMENT (EquipmentID, EquipName, Stock, NextInspection) SUPPLIER (BillerCode, BusinessName, ContactPerson, Phone)
SUPPLIES (EquipmentID, BillerCode) USES_EQUIPMENT (ActivityID, EquipmentID) CLIENT_PREFERENCE (ClientNo, ActivityID) RESERVATION_ACCOMMODATION (ResNo, RoomNo)
ACTIVITY_SUPERVISOR (SupervisorID)
OUTDOOR_INSTRUCTOR (InstructorID, InstrName, InstrPhone,
SupervisorID)
IFIELD (InstructorID, Field)
MASSEUSE (MasseuseID, MassName, MassPhone, Area, SupervisorID) SWIMMING_INSTRUCTOR (SwimmerID, SwimName, SwimPhone, SupervisorID) SUPERVISION (ResNo, ActivityID, SupervisorID, Day, Time)

NOTE: PK is printed underlined and FK is printed italic in italics.

Task 1

Using the tables provided above, provide SQL statements for the following queries.

a. Display the name of the client who has made the most reservations with Getaway Holidays.

b. Display the name of the client who has booked the reservation for the longest period.

c. Display the Room no, Room type, Room rate and No of guests for the reservation made by client(s) having last name "Perez".

d. Display the Name of the equipment and the name of their suppliers (if any) for the outdoor activities with high risk level.

e. Display the details of those reservation that contains a minimum of one set of connected rooms.

f. Display the name of the outdoor instructor who has the most duties as an activity supervisor.

g. Display the name, address and phone number for the clients who has not made any reservations for the past two months. (Name should be displayed in alphabetical order).

h. For each reservation, display the total income coming from activities & total income coming from accommodations along with the reservation number. (Do not consider the discount schemes but consider every reservation even if it does not have any of the costs associated with it).

i. Display the reservations (Reservation number and duration) whose duration is greater than the average duration of reservations.

j. Display the top two most popular activities across all reservations.

Task 2

Provide the implementation of the following stored procedures and function. For submission, please include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the functionality.

a. Write a stored procedure that displays the contact details of clients who does not have any heart conditions or Acrophobia. The resort wants to promote a new outdoor activity to them.

b. Write a stored function that uses the activity ID and date as input and returns the Name of the supervisor assigned for that day.

c. Write a stored procedure that accepts a particular reservation number as input, and as output displays the total layout of the trip in terms of outdoor and indoor activities along with the name of the client and the name of the activity supervisor assigned for each of the activity. (NOTE: this stored procedure should use the function created in Task 2b)

Task 3

Provide the implementation of the following triggers. For submission, please include both the PL/SQL code and an insert statement to demonstrate the trigger functionality.

a. A trigger which automatically raises an error whenever a client with Aqua phobia selects Rafting as a preferred outdoor activity.

b. A trigger that automatically calculates and stores in a separate table called "Reservation_room_expense" the reservation number and the due amount for accommodations for each record number. (Consider the 5% discount on room prices if the trip consists of more than 5 days).

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M92359357
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in PL-SQL

Complete the following tasksin microsoft access create the

Complete the following tasks: In Microsoft Access, create the database and tables that you identified in W3 Assignment 2. In Microsoft Word, write the SQL statements to create the database and tables. Write SQL statement ...

Purpose of the assessment with ulo mapping the purpose of

Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop skills in managing data in databases and to gain understanding of data model development and implementation using a commercially a ...

Continuing the project you have worked on in weeks 1-4 in

Continuing the project you have worked on in Weeks 1-4, in this final week, complete the following tasks: Refine your database and SQL statements by incorporating your instructor's feedback. Verify that the database comp ...

For this assignment you will be provided a database backup

For this assignment, you will be provided a database backup for a database called FinanceDB. You will have to restore this backup to your own version of SQL Server. All of the questions in this assignment relate to the F ...

Assignment - queries functions and triggersaimthe aims of

Assignment - Queries, Functions and Triggers Aim The aims of this assignment are to: formulate SQL queries; populate an RDBMS with a real dataset, and analyse the data; design test data for testing SQL queries; create SQ ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As