Question
please solve this by Oracle SQL Developer/Oracle Live SQL and answer the following question: This is TextbookADT.txt : /* Run the following CREATE statement by
please solve this by Oracle SQL Developer/Oracle Live SQL and answer the following question:
This is TextbookADT.txt :
/* Run the following CREATE statement by itself */ CREATE OR REPLACE TYPE PublisherADT as OBJECT ( PublisherName varchar(30), PublisherCity varchar(30), CopyrightYear char(4), ISBN13 char(13), BookURL varchar(255), MEMBER FUNCTION PubCitation RETURN CHAR ); /* Run the following CREATE statement by itself */ CREATE OR REPLACE TYPE BODY PublisherADT as MEMBER FUNCTION PubCitation RETURN CHAR is begin return PublisherName || '. ' || PublisherCity || 'ISBN: ' || ISBN13 || '. ' || BookURL; end; end; /* Run the following CREATE statement by itself */ CREATE TABLE Textbook ( TextbookID int, Title varchar(255), Category varchar(30), Publisher PublisherADT );
this is DDL, DML:
create table DEPARTMENT (
DNAME VARCHAR(30),
DNUMBER NUMBER(4) PRIMARY KEY,
MGR_SSN CHAR(9),
MGR_START_DATE DATE);
create table EMPLOYEE (
FNAME VARCHAR(30),
MINIT CHAR(1),
LNAME VARCHAR(30),
SSN CHAR(9) PRIMARY KEY,
BDATE DATE,
ADDRESS VARCHAR(30),
SEX CHAR(1),
SALARY NUMBER(5),
SUPER_SSN CHAR(9),
DNO NUMBER(4));
ALTER TABLE EMPLOYEE ADD CONSTRAINT SEXCHECK CHECK (SEX IN ('M','F'));
ALTER TABLE EMPLOYEE ADD CONSTRAINT SALARYCHECK CHECK (SALARY >= 1000 AND SALARY
ALTER TABLE DEPARTMENT ADD CONSTRAINT dept_mgrssn_fk FOREIGN KEY (MGR_SSN) REFERENCES EMPLOYEE(SSN) ON DELETE CASCADE;
ALTER TABLE EMPLOYEE ADD CONSTRAINT emp_superssn_fk FOREIGN KEY (SUPER_SSN) REFERENCES EMPLOYEE(SSN) ON DELETE CASCADE;
ALTER TABLE EMPLOYEE ADD CONSTRAINT emp_dno_fk FOREIGN KEY (DNO) REFERENCES DEPARTMENT(DNUMBER) ON DELETE CASCADE;
create table DEPT_LOCATIONS(
DNUMBER NUMBER(4),
DLOCATION VARCHAR(20),
PRIMARY KEY(DNUMBER,DLOCATION));
ALTER TABLE DEPT_LOCATIONS ADD CONSTRAINT deptloc_dnum_fk FOREIGN KEY (DNUMBER) REFERENCES DEPARTMENT(DNUMBER) ON DELETE CASCADE;
create table PROJECT(
PNAME VARCHAR(30),
PNUMBER NUMBER PRIMARY KEY,
PLOCATION VARCHAR(30),
DNUM NUMBER(4));
ALTER TABLE PROJECT ADD CONSTRAINT proj_dnum_fk FOREIGN KEY (DNUM) REFERENCES DEPARTMENT(DNUMBER) ON DELETE CASCADE;
create table WORKS_ON(
ESSN CHAR(9),
PNO NUMBER,
HOURS NUMBER(4,2),
PRIMARY KEY(ESSN,PNO));
ALTER TABLE WORKS_ON ADD CONSTRAINT workson_essn_fk FOREIGN KEY (ESSN) REFERENCES EMPLOYEE(SSN) ON DELETE CASCADE;
ALTER TABLE WORKS_ON ADD CONSTRAINT workson_pno_fk FOREIGN KEY (PNO) REFERENCES PROJECT(PNUMBER) ON DELETE CASCADE;
create table DEPENDENT(
ESSN CHAR(9),
DEPENDENT_NAME VARCHAR(30),
SEX CHAR(1),
BDATE DATE,
RELATIONSHIP VARCHAR(30),
PRIMARY KEY(ESSN,DEPENDENT_NAME));
ALTER TABLE DEPENDENT ADD CONSTRAINT dep_essn_fk FOREIGN KEY (ESSN) REFERENCES EMPLOYEE(SSN) ON DELETE CASCADE;
INSERT INTO DEPARTMENT VALUES('Research',5,null,to_date('1988-05-22','yyyy-mm-dd'));
INSERT INTO DEPARTMENT VALUES('Administration',4,null,to_date('1995-01-01','yyyy-mm-dd'));
INSERT INTO DEPARTMENT VALUES('Headquarters',1,null,to_date('1981-06-19','yyyy-mm-dd'));
INSERT INTO EMPLOYEE VALUES('James','E','Borg','888665555',to_date('1937-11-10', 'yyyy-mm-dd'), '450 Stone,Houston,TX','M',55000,null,'1');
INSERT INTO EMPLOYEE VALUES('Franklin','T','Wong','333445555',to_date('1955-12-08','yyyy-mm-dd'),'638 Voss,Houston,TX','M',40000,'888665555','5');
INSERT INTO EMPLOYEE VALUES('John','B','Smith','123456789',to_date('1965-01-09','yyyy-mm-dd'),'731 Fondren,Houston,TX','M',30000,'333445555','5');
INSERT INTO EMPLOYEE VALUES('Jennifer','S','Wallace','987654321',to_date('1941-06-20', 'yyyy-mm-dd'),'291 Berry,Bellaire,TX','F',43000,'888665555','4');
INSERT INTO EMPLOYEE VALUES('Alicia','J','Zelaya','999887777',to_date('1968-01-19', 'yyyy-mm-dd'),'3321 Castle,Spring,TX','F',25000,'987654321','4');
INSERT INTO EMPLOYEE VALUES('Ramesh','K','Narayan','666884444',to_date('1962-09-15', 'yyyy-mm-dd'),'975 Fire Oak,Humble,TX','M',38000,'333445555','5');
INSERT INTO EMPLOYEE VALUES('Joyce','A','English','453453453',to_date('1972-07-31', 'yyyy-mm-dd'),'5631 Rice,Houston,TX','F',25000,'333445555','5');
INSERT INTO EMPLOYEE VALUES('Ahmad','V','Jabbar','987987987',to_date('1969-03-29', 'yyyy-mm-dd'),'980 Dallas,Houston,TX','M',25000,'987654321','4');
UPDATE DEPARTMENT SET MGR_SSN='333445555' WHERE DNUMBER=5;
UPDATE DEPARTMENT SET MGR_SSN='987654321' WHERE DNUMBER=4;
UPDATE DEPARTMENT SET MGR_SSN='888665555' WHERE DNUMBER=1;
INSERT INTO DEPT_LOCATIONS VALUES(1,'Houston');
INSERT INTO DEPT_LOCATIONS VALUES(4,'Stafford');
INSERT INTO DEPT_LOCATIONS VALUES(5,'Bellaire');
INSERT INTO DEPT_LOCATIONS VALUES(5,'Sugarland');
INSERT INTO DEPT_LOCATIONS VALUES(5,'Houston');
INSERT INTO PROJECT VALUES('ProductX',1,'Bellaire',5);
INSERT INTO PROJECT VALUES('ProductY',2,'Sugarland',5);
INSERT INTO PROJECT VALUES('ProductZ',3,'Houston',5);
INSERT INTO PROJECT VALUES('Computerization',10,'Stafford',4);
INSERT INTO PROJECT VALUES('Reorganization',20,'Houston',1);
INSERT INTO PROJECT VALUES('Newbenefits',30,'Stafford',4);
INSERT INTO WORKS_ON VALUES('123456789',1,32.5);
INSERT INTO WORKS_ON VALUES('123456789',2,7.5);
INSERT INTO WORKS_ON VALUES('666884444',3,40.0);
INSERT INTO WORKS_ON VALUES('453453453',1,20.0);
INSERT INTO WORKS_ON VALUES('453453453',2,20.0);
INSERT INTO WORKS_ON VALUES('333445555',2,10.0);
INSERT INTO WORKS_ON VALUES('333445555',3,10.0);
INSERT INTO WORKS_ON VALUES('333445555',10,10.0);
INSERT INTO WORKS_ON VALUES('333445555',20,10.0);
INSERT INTO WORKS_ON VALUES('999887777',30,30.0);
INSERT INTO WORKS_ON VALUES('999887777',10,10.0);
INSERT INTO WORKS_ON VALUES('987987987',10,35.0);
INSERT INTO WORKS_ON VALUES('987987987',30,5.0);
INSERT INTO WORKS_ON VALUES('987654321',30,20);
INSERT INTO WORKS_ON VALUES('987654321',20,15.0);
INSERT INTO WORKS_ON VALUES('888665555',20,null);
INSERT INTO DEPENDENT VALUES('333445555','Alice','F',to_date('1986-04-05','yyyy-mm-dd'),'Daughter');
INSERT INTO DEPENDENT VALUES('333445555','Theodore','M',to_date('1983-10-25','yyyy-mm-dd'),'Son');
INSERT INTO DEPENDENT VALUES('333445555','Joy','F',to_date('1958-05-03','yyyy-mm-dd'),'Spouse');
INSERT INTO DEPENDENT VALUES('987654321','Abner','M',to_date('1942-02-28','yyyy-mm-dd'),'Spouse');
INSERT INTO DEPENDENT VALUES('123456789','Michael','M',to_date('1988-01-04','yyyy-mm-dd'),'Son');
INSERT INTO DEPENDENT VALUES('123456789','Alice','F',to_date('1988-12-30','yyyy-mm-dd'),'Daughter');
INSERT INTO DEPENDENT VALUES('123456789','Elizabeth','F',to_date('1967-05-05','yyyy-mm-dd'),'Spouse');
commit;
This is TextbookADTData.xlsx :
TextbookID | Title | Category | PublisherName | PublisherCity | CopyrightYear | ISBN13 | BookURL |
1001 | Fundamentals of Database Systems | Database | Pearson | Essex, UK | 2017 | 9781292097619 | http://www.pearsonglobaleditions.com/elmasri |
2001 | Beginning ASP.NET 4.5.1 | Programming | John Wiley & Sons | Indianapolis, IN USA | 2014 | 9781118846773 | http://imar.spaanjaars.com |
.Execute the DDL contained in the file to create the objects Use the data from the TextbookADTData.xlsx file to complete item (4) below Write INSERT statement(s) to add row(s) to the Textbook table included in the TextboodADT.txt file .Paste the insert statement(s) below
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