Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help using SQL plus or SQL Developer INSTRUCTOR: table [ [ INS _ ID , INS _ FNAME,INS _ SNAME,INS _ CONTACT,INS _

please help using SQL plus or SQL Developer
INSTRUCTOR:
\table[[INS_ID,INS_FNAME,INS_SNAME,INS_CONTACT,INS_LEVEL],[101,James,Willis,0843569851,7],[102,Sam,Wait,0763698521,2],[103,Sally,Gumede,0786598521,8],[104,Bob,Du Preez,0796369857,3],[105,Simon,Jones,0826598741,9]]
CUSTOMER
\table[[CUST_ID,CUST_FNAME,CUST_SNAME,CUST_ADDRESS,CUST_CONTACT],[C115,Heinrich,Willis,3 Main Road,0821253659],[C116,David,Watson,13 Cape Road,0769658547],[C117,Waldo,Smith,3 Mountain Road,0863256574],[C118,Alex,Hanson,8 Circle Road,0762356587],[C119,Kuhle,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],[C123,Catherine,Howard,31 Lake Side Road,0822232521]]
DIVE:
\table[[DIVE_ID,DIVE_NAME,DIVE_DURATION,DIVE_LOCATION,DIVE_EXP_LEVEL,DIVE_COST],[550,Shark Dive,3 hours,Shark Point,8,500],[551,Coral Dive,1 hour,Break Point,7,300],[552,\table[[Wave],[Crescent]],2 hours,Ship wreck ally,3,800],[553,\table[[Underwater],[Exploration]],1 hour,Coral ally,2,250],[554,\table[[Underwater],[Adventure]],3 hours,Sandy Beach,3,750],[555,\table[[Deep Blue],[Ocean]],30 minutes,Lazy Waves,2,120],[556,Rough Seas,1 hour,Pipe,9,700],[557,White Water,2 hours,Drifts,5,200],[558,\table[[Current],[Adventure]],2 hours,Rock Lands,3,150]]
DIVE_EVENT:
\table[[\table[[DIVE_EVENT_I],[D]],DIVE_DATE,DIVE_PARTICIPANTS,INS_ID,CUST_ID,DIVE_ID],[de_101,15/JUL/17,5,103,C115,558],[de_102,16/JUL/17,7,102,C117,555],[de_103,18/JUL/17,8,104,C118,552],[de_104,19/JUL/17,3,101,C119,551],[de_105,21/JUL/17,5,104,C121,558],[de_106,22/JUL/17,8,105,C120,556],[de_107,25/JUL/17,10,105,C115,554],[de_108,27/JUL/17,5,101,C122,552],[de_109,28/JUL/17,3,102,C123,553]]
Question 1
create the tables and
populate the tables
Question 2
(Marks: 5)
TASK: Segregation of Duties.
As a first in setting up controls to ensure the security of the system and data, you are required to create two user roles for the database as follows:
An administrator user
General user of the system
Use any user names to distinguish and set up users. Determine the privileges required for each role. Make use of comments to highlight the choices and assumptions made.
Question 3
(Marks: 5)
TASK: Query the number of Participants.
Using SQL only, display the instructor's and customer's full names, including the location and number of participants attending a dive with a participation of between 8 and 10 individuals.
24
Question 4
(Marks: 5)
TASK: Query the dives with more participants
Using PL/SQL., display the dive name and the allocated date. In your query, only display the dive events that have 10 or more participants.
Question 5
(Marks: 10)
Task: Query the number of Instructors required.
ADC would like to enforce a new policy which will need to be implemented as follows:
For a dive with 4 or less participants, only 1 instructor will be required.
For a dive with 5 and up to 7 participants, 2 instructors will be required.
For a dive where 8 or more participants are registered, 3 instructors will be allocated.
Using PL/SQL, create a report which shows the customer's full name, the dive event name and the dive participants for any dive that costs over R 500. In your query, display how many instructors are required for the dive.
Make use of at least 2 appropriate Cursor attributes in the Declaration part of the cursor.
Question 6
(Marks: 5)
TASK: Create View
Management would like the receptionist to be able to query the database without having full access to it. You are required to provide a functionality for this using a View called Vw_Dive_Event that will display the instructor ID, customer ID, customer address and dive duration for any dive occurring before the 19 July 2017.
Question 7
(Marks: 10)
TASK: Create Trigger
Create a trigger called New_Dive_Event that will prevent an entry into the dive event table that has 0 or less participants and also more than 20 participants. In your query, also display the code(s) to test the trigger on all conditions.
Question 8
(Marks: 15)
TASK: Create Stored Procedure
Create a procedure called sp_Customer_Details that will accept a customer ID and dive date as input parameters and will display the customer and dive name booked for the particular date.
In your solution, display the data for any customer and provide the code to execute the procedure with an exception handling if no customer is found.
Sample Result Format:
CUSTOMER DETAILS: Heinrich Willis booked for the Current Adventure on the 15/JUL/17.
Question 9
(Marks: 15)
TASK: Create a Function
Create a meaningful function for the company. The function should accept an input parameter and add perform a calculation on the data, with relevant
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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

7. Senior management supports the career system.

Answered: 1 week ago