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

  1 write a query to display using the employees table the

1. write a query to display using the employees table the employeeid firstname lastname and hiredate of every employee

  Take the text files and ddl files

Take the text files and DDL files that are attached and make a working script database - Correct any errors

  Question 1write a perl subroutine for temperature

question 1write a perl subroutine for temperature conversion named converttemp. it should be able to handle both

  Write a select statement

Write a Select statement that determines whether the PaymentDate column of The Invoices table has any invalid values.

  What types of users would typically use a dml statement

You must begin by understanding the different types of SQL statements. Adhere to the following deliverables for this Discussion Board.

  Describe group,union,join and insert

Write a SQL query that joins Customer and Store table in the Kudler database and uses BETWEEN to restrict record selection

  Analyze how sql differs from a programming language

In addition to this, analyze how SQL differs from a programming language with which you are familiar. Explain your general opinions of SQL thus far, and classify it as easy or not, and as useful or not.

  Test and compile the sql queries

The Strayer Oracle Server may be used to test and compile the SQL Queries developed for this assignment. Your instructor will provide you with login credentials to a Strayer University maintained Oracle server.

  Create a text file called yourstudentid

Create a text file called YourStudentId-Create.sql (format xxxxxxx-Create.sql) for example 2225991- Create.sql that will.

  Can we offer an example of a query

Can we offer an example of a Query in which we can use a parentheses to affect the order of execution in which the WHERE Clause has both AND and OR Logical Operators?

  Write sql statements for the ten queries

Write SQL statements for the ten queries - find the names of all Tracks that are more than 10 minutes (600,000 ms) long. Result: (name: varchar(255))

  How many times a customer generated an invoice

Write SQL statements to answer the following questions from the ‘assignment5'Database: Answer all questions.

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