Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help using SQL Developer or SQL * Plus CUSTOMER table [ [ CUSTOMER _ ID , FIRST _ NAME,SURNAME,ADDRESS,CONTACT _ NUMBER,EMAIL ] ,

please help using SQL Developer or SQL * Plus
CUSTOMER
\table[[CUSTOMER_ID,FIRST_NAME,SURNAME,ADDRESS,CONTACT_NUMBER,EMAIL],[11011,Jack,Smith,18 Water Rd,0877277521,jsmith@isat.com],[11012,Pat,Hendricks,22 Water Rd,0863257857,ph@mcom.co.za],[11013,Andre,Clark,\table[[101 Summer],[Lane]],0834567891,aclark@mcom.co.2a],[11014,Kevin,Jones,\table[[55 Mountain],[way]],0612547895,kj@isat.co.2a],[11015,Lucy,Williams,5 Main rd,0827238521,lw@mcal.co.za]]
EMPLOYEE
\table[[EMPLOYEE_ID,FIRST_NAME,SURNAME,CONTACT_NUMBER,ADDRESS,EMAIL],[emp101,Jeff,Davis,0877277521,10 main road,jand@isat.com],[emp102,Kevin,Marks,0837377522,\table[[18 water],[road]],km@isat.com],[emp103,Adanya,Andrews,0817117523,21 circle lane,aa@isat.com],[emp104,Adebayo,Dryer,0797215244,1 sea road,aryer@isat.com],[emp105,Xolani,Samson,0827122255,12 main road,xosam@isat.com]]
DONATOR
\table[[DONATOR_ID,FIRST_NAME,SURNAME,CONTACT_NUMBER,EMAIL],[20111,Jeff,Watson,0827172250,jwatson@ymail.com],[20112,Stephen,Jones,0837865670,joness@ymail.com],[20113,James,Joe,0878978650,j@@isat.com],[20114,Kelly,Ross,0826575650,kross@gsat.com],[20115,Abraham,Clark,0797656430,aclark@ymail.com]]
DONATION
\table[[DONATION_ID,DONATOR_ID,DONATION,PRICE,DONATION_DATE],[7111,20111,KIC Fridge,R 599,1 May 2024],[7112,20112,Samsung 42inch LCD,R1299,3 May 2024],[7113,20113,Sharp Microwave,R 1599,3 May 2024],[7114,20115,6 Seat Dining room table,R 799,5 May 2024],[7115,20114,Lazyboy Sofa,R1199,7 May 2024],[7116,20113,JVC Surround Sound System,R 179,9 May 2024]]
DELIVERY
\table[[DELIVERY_ID,DELIVERY_NOTES,DISPATCH_DATE,DELIVERY_DATE],[511,Double packaging requested,10 May 2024,15 May 2024],[512,Delivery to work address,12 May 2024,15 May 2024],[513,Signature required,12 May 2024,17 May 2024],[514,No notes,12 May 2024,15 May 2024],[515,Birthday present wrapping required,18 May 2024,19 May 2024],[516,Delivery to work address,20 May 2024,25 May 2024]]
RETURNS
\table[[RETURN_ID,RETURN_DATE,REASON,CUSTOMER_ID,DONATION_ID,EMPLOYEE_ID],[ret001,25 May 2024,Customer not satisfied with product,11011,7116,emp101],[ret002,25 May 2024,Product had broken section, 11013,7114,emp103]]
INVOICE
\table[[INVOICE_NUM,CUSTOMER_ID,INVOICE_DATE,EMPLOYEE_ID,DONATION_ID,DELIVERY_ID],[8111,11011,15 May 2024,emp103,7111,511],[8112,11013,15 May 2024,emp101,7114,512],[8113,11012,17 May 2024,emp101,7112,513],[8114,11015,17 May 2024,emp102,7113,514],[8115,11011,17 May 2024,emp102,7115,515],[8116,11015,18 May 2024,emp103,7116,516]]
Question 1
Please create the tables and populate them using SQL Developer or SQL*Plus.
Question 2
(Marks: 5)
CHARITY 4 AFRICA requires a report containing the combined customer name, employee id, delivery notes, donation purchased and the invoice number. Create a SQL query to generate the required report. In your query, only display the results that have any invoice date before 18 May 2024.
Question 3
(Marks: 10)
Management of CHARITY 4 AFRICA would like to add a new table called Funding that at present will not have any referential integrity. The organisation would like an automatically generated unique id every time a record is inserted into the new table. The attributes the table must contain for now are funding_id, funder, and funding amount.
Create the new table and implement a solution to aut omatically generate the unique ids with every new insert. In your solution provide an example of the insert statement.
Question 4
(Marks: 10)
Create a PL/SQL query to display the combined customer name, donation purchased, donation price and the reason that the donation was returned.
Sample Output:
CUSTOMER: Jack, Smith
DONATION PURCHASED: JVC Surround Sound System
PRICE: 179
RETURN REASON:Customer not satisfied with product
CUSTOMER: Andre, Clark
DONATION PURCHASED: 6 Seat Dining rm table
PRICE: 799
RETURN REASON: Product had broken section
Question 5
(Marks: 15)
Create a PL/SQL query to display the customer's name, employee name, donation, dispatch date and the delivery date. In your query, also display the number of days between the dispatch date and the delivery date in days for customer 11013.
Question 6
(Marks: 20)
Create a report to display the combined customer name and total amount spent by each customer on the purchases. In your solution determine the customer rating as follows: If the total spent amount is greater than or equal to R 1500 the customer receives a star rating, otherwise no star rating applies.
Question 7
(Marks: 30)
Provide relevant code examples, with code comments based on this case study of how to implement the following:
Note: Provide your own code examples with comments and the achieved output for each question. The reuse of codes from the previous questions (Q.1-Q.6) will be awarded a 0.
Q.7.1%TYPE attribute;
(5)
Q.7.2%ROWTYPE attribute
(5)
Q.7.3 System defined exception.
(10)
Q.7.4 User defined exception
(10)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions