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 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 conceptualphysical 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;
Alter table Customers
add constraint CustRefHier
Foreign Key RefCust
References CustomersCUSTID;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Zhang' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Zhang' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Martin' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Martin' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Martin' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Chen' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Chen' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Perez' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Perez' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Jackson' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Jackson' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Jefferson' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Jefferson' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
UPDATE Customers SET RefCustSelect custid FROM Customers where CUSTNAME'Stewart' WHERE CUSTIDSelect custid FROM Customers where CUSTNUM;
Extract from customers:
names adding indent of "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 levels of the tree.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
