Write a stored procedure that displays the contact details

Assignment Help PL-SQL Programming
Reference no: EM131550637

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

Reference no: EM131550637

Questions Cloud

What should investors par for march hair : With required rates of return at 14 percent, what should investors par for March Hair?
What should investors par for march hair : After that time the dividend will likely decline to 5 percent per year, forever. With required rates of return at 14 percent, what should investors.
What impact do benefit offerings have on marketplace : What impact do benefit offerings have on marketplace competitiveness and the ability to attract and keep quality employees?
Find the standards given control limits : In a packaging department of a food processor, types of packaging "imperfections" are carefully defined and include creases, holes, printing smudges.
Write a stored procedure that displays the contact details : Write a stored procedure that displays the contact details of clients who does not have any heart conditions or Acrophobia - Write a stored function
Identify the main points of each given reading : Identify the main points of each reading and discuss critically and analytically-use your sociological imagination.
The position cultivates a sense of intrinsic motivation : Identify the position's current major components, tasks, or responsibilities.Assess whether the position cultivates a sense of intrinsic motivation.
Have you ever needed just the facts : Have you ever needed just the facts? For this assignment, you will write an informative essay on the topic you have previously chosen.
Net present value of this expansion project : What is the net present value of this expansion project at a required rate of return of 14 percent?

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

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