Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First, have a look at conceptual / physical model. All required is the SQL code AND screenshots of outputs of these queries in Oracle SQL
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started