Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help using SQL plus or SQL developer STOCK table [ [ STOCK _ ID , STOCK _ TYPE,STOCK _ MODEL _ , MANUFACTURER

please help using SQL plus or SQL developer
STOCK
\table[[STOCK_ID,STOCK_TYPE,STOCK_MODEL_,MANUFACTURER],[12345,Desktop,Proline K100,Acer],[54321,Laptop,J55,Mecer],[78945,Server,HP9000,Samsung],[98754,Laptop,Aspire 450,HP],[55355311,Notebook, L920, lenovo]]
CUSTOMER
\table[[CUST ID,CUST_FNAMECUST_SNAME,CUST_ADDRESS,CUST_CONTACT,],[C115,Jeff,Willis,3 Main Road,0821253659],[C116,Andre,Watson,13 Cape Road,0769658547],[C117,Wallis,Smith,3 Mountain Road,0863256574],[C118,Alex,Hanson,8 Circle Road,0762356587],[C119,Bob,Bitterhout,15 Main Road,0821235258],[C120,Thando,Zolani,88 Summer Road,0847541254],[C121,Philip,Jackson,3 Long Road,0745556658],[C122,Sarah,Jones,7 Sea Road,0814745745]]
REPAIRS
\table[[REPAIR_ID,REPAIR_WORK,REPAIR_DATE,REPAIR_HOURS],[1,HD defragmentation,15/JUL/23,2],[2,\table[[RAM module replaced. Time taken to],[diagnose problem]],18/JUL/23,3],[3,Battery Replaced,19/JUL/23,2],[4,OS Upgraded,20/JUL/23,2],[5,Faulty hard disk replaced,25/JUL/23,3]]
SALES
\table[[SALES_NUM,SALES_DATE,SALES_AMT,STOCK_ID,CUST_ID,REPAIR_ID],[101,27/JUL/23,R 1700,98754,C121,3],[102,20/JUL/23,R 1500,12345,C120,4],[103,23JUL23,R 1650,55311,C119,5],[104,17/JUL/23,R 1300,54321,C117,2],[105,19/JUL/23,R 1900,12345,C122,1]]
QUESTION 1
CREATE AND POPULATE THE TABLES
Question 2
(Marks: 5)
TASK: Query Time taken to complete Repairs.
Using SQL only; display the combined customer name, the repair work, repair date and repair hours. In your query only display the results that had a repair time less than 3 hours.
Question 3
(Marks: 5)
TASK: Query Sales Made
Using .QL, display the Customer ID, Stock Type and the Sales Amount. In your query only display the results where the sales amount is less than R 1500.
Question 4
(Marks: 15)
TASK: Query Calculate Commission
IT Gear Dealer has a policy that states that, for any individual sale made, the employee who completed the repair work receives a certain commission.
Using PL/SQL, display the Customer ID, Stock ID, Sales Number, the Repair ID, the Sales Amount, and the commission payable which will be calculated as follows:
For an individual sale of R999 or less, apply a 5% commission.
An individual sale between R1000 and R1499, apply a 10% commission.
An individual sale of R1500 or more, apply a 15% commission.
Question 5
(Marks: 5)
TASK: Create View
Create a view called Repair_View that will display the combined Customer Name, Stock ID, Repair Date and the Repair Work done. In your query also include the statement to run the view.
Question 6
(Marks: 10)
TASK: Create Trigger
Create a Trigger called Sales_Entry that will prevent a user from entering a sales amount that is less than zero. In your query include the code to test the trigger.
Question 7
TASK: Create Stored Procedure
(Marks: 15)
Create a stored procedure called sp_customer_details that accepts sales and display the customer id, customer first name, surname and their contact number.
In your solution display the data for any customer and provide the code to execute the procedure with relevant exception handling and relevant code comments.
Question 8
(Marks: 15)
TASK: Create Function
Create a function called fn_IT_Gear that would be meaningful and relevant for this database. Your function should accept at least 1 input-parameter and display at least 4 relevant pieces of information:
In your solution,
display the data and provide the code to execute the function.
use relevant exception handling and
provide relevant code comments
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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Define conformity. (p. 350)

Answered: 1 week ago

Question

Why is executive onboarding for external hires so difficult?

Answered: 1 week ago

Question

1. What is perception?

Answered: 1 week ago