Demonstrate your foreign key constraints work correctly

Assignment Help PL-SQL Programming
Reference no: EM132384463

Aussie Wine Tours

Part 1. Create a fully expanded ERD based on the information in the following narrative.

Business Narrative

Aussie Wine Tours (AWT) conduct tours of the wineries of Victoria's Yarra Valley wine region. Each tour is run on a single day. Currently, there are several wine tours including The White Wine tour, The Red Wine tour and The Sparkling Wine tour. The Red Win Tour is a very popular tour and has often run 3 or 4 times in a single month. The tour schedule depends upon the availability of the wineries, the availability of the tour leaders and the public interest.

Each tour takes usually takes around 6 hours to complete and is led by one or more of AWT's well-renowned wine experts.
Each tour has a 'current price'. However, due to various market forces, prices have been rising over the past couple of years. For example, last year the Red Wine Tour was $170 but now it's the current price is $200.
No two events for the same tour can occur on the same day. (e.g. The Red Wine Tour cannot be conducted twice on the same day).
AWT have many satisfied customers, many of whom have attended multiple wine tours over the years. Each customer has a customer id, name, address and contact phone number.
AWT usually plan and advertise wine tour details and dates about 6 months prior to the running of each tour. Customers usually ring AWT to make bookings for their wine tour. Each booking stored in the AWT system is for a single person. (E.g. A husband and wife attending the same tour event will have two bookings created for them. Each booking is for a single customer).
AWT have a number of printed wine tour brochures - one for each of the different wine tour (E.g. A 4page printed glossy brochure that has photos and details of the Red Wine Tour).
People often ring up or email AWT and request a brochure. Brochures are only sent to customers.

If the person requesting a brochure is not already a customer, then AWT create a new customer by assigning a customer id and recording the person's name, address and phone number. When a brochure is requested, AWT record the date of the request. After the brochure is mailed to the customer, AWT record the date that the brochure was sent. Obviously, a customer who requests a brochure is not under any obligation to make any bookings.
A customer makes payment(s) for each booking. Each payment made is for a single booking. AWT record the amount of the payment, the date of the payment, the type of payment made (cash, credit card or cheque) and which booking the payment is for.

Some customers may two or more payments for single booking (e.g. the tour price is $200 and the customer makes two payments $120 and $80.)
Sometimes (though rarely), a customer makes a payment for an amount larger than required. AWT simply record the amount of the payment. (You simply have to record the amount of the payments made. You do not need to concern yourself with how refunds or payment transfers may occur).
AWT have a number of gifts available for participants attending tour events. Generally, three or four gifts are offered to participants of a tour event. The gifts on offer are often decided by a mixture of the type of tour, the whim of the wine expert leading the event and availability of stock. On the day of the event, each participant may choose a maximum of two gifts. AWT records which gifts are chosen by each booked customer. Obviously, a customer has the right to not select any gifts while attending a tour.

Note: You are not expected to limit the number of gifts selected by a customer to 2. This is beyond the scope of an ERD. Such a restriction would normally be programmatically solved using a Stored Procedure, Trigger or some other programming technique).

IMPORTANT: You must not ask answers or assistance from your tutor as this is an assessment that needs to be done by team members by themselves. The tutor will provide only general guidelines only.

Part 2.
• Create a Relational Schema based on your ERD.

Part 3.
• Create a file called Ass2_SQLScript.TXT which contains SQL statements that can be executed by your tutor. All SQL statements must be able to be executed successfully in Oracle Live SQL.

• Add the Create Table to the script file to create all of the tables.
• All tables must enforce primary key and foreign key constraints. Surrogate Keys must not be introduced into your solution.
• Add the Insert statements to populate your tables with only the data used in Appendix A below. Do not add your own data.
Part 4.
Demonstrate your foreign key constraints work correctly. Each of the generated Insert statements must fail due to foreign key constraint errors. Add the Insert statements to the script file.
1. Attempt to insert a row that allocates expert # 22 to Tour B1 conducted on 2020/02/18.
2. Attempt to insert a row that books customer C078 on Tour W1 conducted on 2020/01/01.
3. Attempt to insert a row that makes a payment for customer C225 conducted on Tour W1 conducted on 2020/01/01.
4. Attempt to insert a row that allocates gift G09 to Tour W1 conducted on 2020/01/01.
5. Attempt to insert a row that allows customer C123 to select gift G09 on Tour R2 conducted on 2020/10/07.

Part 5.
Create SQL queries to do the following. Add the SQL statements to the script file.

Query 1. List Customer No, Name, Address and Phone No of all customers. The List must be in Customer No sequence.

Query 2.
List tour code, event date, wine expert name(s) of all tour events.
The List must be in tour code, event date, wine expert surname sequence.

Query 3.
List tour code, event date, customer no and customer name for every booking made
The List must be in tour code, event date, customer no sequence.
Query 4. List tour code, event date, gift code and gift description for all gifts offered on all tour events The List must be in tour code, event date, gift code
sequence.

Query 5. List tour code, event date, customer no and customer name, gift code and gift description for all gifts selected by customers on all tour events
The List must be in tour code, event date, customer no, gift code sequence.

Part 6.
Query 6. List Customer No, Customer Name, total payments made by all customers who have made bookings. Include customer that may never made a booking. The List must be in Customer No sequence

Query 7. List Tour Code and total payments made for all tours. The List must be in Tour Code sequence

Query 8.
List gift code and gift description and total number of times that a gift has been selected by a booked customer.
Include all gifts that may never have been selected. The List must be in descending total sequence

Query 9.
List the current price and the minimum price charged for each tour.
E.g. Tour X1 has a current price of $500. Ten months ago, this course ran and the price was $425
The list would show:
Tour Code Description Current Price Minimum Price
X1 Expensive Wine Tour 500 425
Query 10. List Customer No, Customer Name, tour code, event date for all customers who requested a brochure for a tour and then made a booking for that tour.

Script execution and output requirements
Your submission must include the output generated by your script file after the entire script has been executed in Oracle Live SQL. The output must be pasted and copied into a Word file.

Attachment:- Database Design and Use.rar

Verified Expert

The given graphical system was implemented in this task. The creation of table was done using the oracle sql. The insertion statements were also provided and their implementation screenshots were also provided. The deletion statements were also provided for each schema.

Reference no: EM132384463

Questions Cloud

Looking for in terms of patterns : Where would you be gathering the data and what would you be looking for in terms of patterns, predictive analytics, etc.? Show the references resources.
What is the future of business analytics : What is the future of business analytics? Provide at least three reasons to support your argument. Provide a minimum of three references.
Foster innovation and creativity from employees : What can organizations do to foster innovation and creativity from their employees?
Compare person-centered theory with maslow hierarchy : Compare person-centered theory with Maslow's hierarchy of needs. Outline main components of person-centered theory that contribute to personality development
Demonstrate your foreign key constraints work correctly : Demonstrate your foreign key constraints work correctly. Each of the generated Insert statements must fail due to foreign key constraint errors. Add the Insert
Why is self-awareness of personality traits : Why is self-awareness of your personality traits, management style, and learning style important before you can become an effective leader?
Beneficial or destructive to the industry : To what extent the competition is beneficial or destructive to the industry? (Price competition, advertising battles, new product introduction
Should a parent have right to refuse a lifesaving treatment : Should a parent have the right to refuse a lifesaving treatment (e.g., transfusion) for a minor? Explain. To support your work, use your course and textbook.
Bridge between analytics and business decision making : The stakeholder presentation serves as the bridge between analytics and business decision making. Choose organization (Wawa) that you are passionate about.

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