Question: [ PLS , I NEED THE ANSWER IN 2 HOURS CAR RENTAL SCRIPT - ADDING HIERARCHY TO CUSTOMERS - - - NOTE!!!! DO NOT FORGET

[PLS, I NEED THE ANSWER IN 2 HOURS CAR RENTAL SCRIPT - ADDING HIERARCHY TO CUSTOMERS-
--NOTE!!!! DO NOT FORGET TO TAKE INTO ACCOUNT THE CODE BELOW, WHICH REPRESENTS HIERARCHY.; JUST THE SQL CODES; BUT KEEP IN MIND NOT TO MAKE IT TOO COMPLICATED AS I AM A BACHELOR STUDENT IN DBMS COURSE] First, have a look at conceptual/physical model. All required is the SQL code AND screenshots of outputs of these queries in Oracle SQL Developer, but since I couldn't send the data of these tables, I just want you to write the SQL code and see all the screenshots and my descriptions in this text. Please, read carefully and make sure the queries are correct and executable:
Before extracting data, launch script below. Script creates hierarchy (unary relation) in table customer and adds data.
Alter table Customers ADD RefCust NUMBER(6);
Alter table Customers
add constraint CustRefHier
Foreign Key (RefCust)
References Customers(CUSTID);
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Zhang') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='133819');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Zhang') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='182194');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Martin') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='246754');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Martin') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='285028');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Martin') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='294827');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Chen') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='381074');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Chen') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='429292');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Perez') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='482910');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Perez') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='539118');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Jackson') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='592937');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Jackson') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='730282');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Jefferson') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='876586');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Jefferson') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='925820');
UPDATE Customers SET RefCust=(Select custid FROM Customers where CUSTNAME='Stewart') WHERE CUSTID=(Select custid FROM Customers where CUSTNUM='956732');
Extract from customers:
- names adding indent of 3 "spaces" for every next level;
- show customer level number in the hierarchy;
- show tree path from current customer up to top customer in the hierarchy;
- show only first 4 levels of the tree.
 [PLS, I NEED THE ANSWER IN 2 HOURS CAR RENTAL SCRIPT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!