Create an XML document for the Oracle Starter Database Tables (i.e., emp, dept, ord, product, price). Each XML document must be in the format as described in the "Mapping tables to XML" section on pg. 1161 (any column that does not have a value can be displayed as empty, e.g., <DEGREE></DEGREE> ). The name for each document will be the name of the table followed by ".xml" as the file extension (e.g., "emp.xml")
Data for PRICE Table:
CREATE TABLE PRICE ( PRODID NUMBER (6) NOT NULL, STDPRICE NUMBER (8,2), MINPRICE NUMBER (8,2), STARTDATE DATE, ENDDATE DATE);
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('4.8', TO_DATE('01-JAN-1985','DD-MON-YYYY'), '100871', '3.2', TO_DATE('01-DEC-1985','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('58', TO_DATE('01-JAN-1985','DD-MON-YYYY'), '100890', '46.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('54', TO_DATE('01-JUN-1984','DD-MON-YYYY'), '100890', '40.5', TO_DATE('31-MAY-1984','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('35', TO_DATE('01-JUN-1986','DD-MON-YYYY'), '100860', '28', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('32', TO_DATE('01-JAN-1986','DD-MON-YYYY'), '100860', '25.6', TO_DATE('31-MAY-1986','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('30', TO_DATE('01-JAN-1985','DD-MON-YYYY'), '100860', '24', TO_DATE('31-DEC-1985','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('45', TO_DATE('01-JUN-1986','DD-MON-YYYY'), '100861', '36', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('42', TO_DATE('01-JAN-1986','DD-MON-YYYY'), '100861', '33.6', TO_DATE('31-MAY-1986','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('39', TO_DATE('01-JAN-1985','DD-MON-YYYY'), '100861', '31.2', TO_DATE('31-DEC-1985','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.8', TO_DATE('01-JAN-1986','DD-MON-YYYY'), '100870', '2.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.4', TO_DATE('01-JAN-1985','DD-MON-YYYY'), '100870', '1.9', TO_DATE('01-DEC-1985','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('5.6', TO_DATE('01-JAN-1986','DD-MON-YYYY'), '100871', '4.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('24', TO_DATE('15-FEB-1985','DD-MON-YYYY'), '101860', '18', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('12.5', TO_DATE('15-FEB-1985','DD-MON-YYYY'), '101863', '9.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('3.4',TO_DATE( '18-AUG-1985','DD-MON-YYYY'), '102130', '2.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.4', TO_DATE('15-NOV-1986','DD-MON-YYYY'), '200376', '1.75', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('4', TO_DATE('15-NOV-1986','DD-MON-YYYY'), '200380', '3.2', '');<!DOCTYPE CATALOG [
<!ELEMENT PRICE (CD*)
<!ELEMENT CD (PRODID,STDPRICE,MINPRICE,STARTDATE
,ENDDATE)>
<!ELEMENT PRODID (#PCDATA)>
<!ELEMENT STDPRICE (#PCDATA)>
<!ELEMENT STARTDATE (#PCDATA)>
<!ELEMENT MINPRICE(#PCDATA)>
<!ELEMENT ENDDATE (#PCDATA)>
]>
<CATALOG>
<CD>
<STDPRICE>4.8</STDPRICE>
<STARTDATE>01-JAN-1985</STARTDATE>
<PRODID>100871<PRODID>
<MINPRICE>3.2</MINPRICE>
<ENDATE>01-DEC-1985</ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>58</STDPRICE>
<STARTDATE>01-JAN-1985</STARTDATE>
<PRODID>100890<PRODID>
<MINPRICE>46.4</MINPRICE>
<ENDATE></ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>54</STDPRICE>
<STARTDATE>01-JUN-1984</STARTDATE>
<PRODID>100890<PRODID>
<MINPRICE>40.5</MINPRICE>
<ENDATE></ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>35</STDPRICE>
<STARTDATE>01-JUN-1986</STARTDATE>
<PRODID>100890<PRODID>
<MINPRICE>28</MINPRICE>
<ENDATE></ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>32</STDPRICE>
<STARTDATE>01-JAN-1986</STARTDATE>
<PRODID>100890<PRODID>
<MINPRICE>25.6</MINPRICE>
<ENDATE>31-MAY-1986</ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>30</STDPRICE>
<STARTDATE>01-JAN-1985</STARTDATE>
<PRODID>100890<PRODID>
<MINPRICE>24</MINPRICE>
<ENDATE>31-DEC-1985</ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>45</STDPRICE>
<STARTDATE>01-JUN-1986</STARTDATE>
<PRODID>100861<PRODID>
<MINPRICE>36</MINPRICE>
<ENDATE></ENDDATE>
<CATALOG>
<CD>
<CATALOG>
<CD>
<STDPRICE>42</STDPRICE>
<STARTDATE>01-JAN-1986</STARTDATE>
<PRODID>100861<PRODID>
<MINPRICE>33.6</MINPRICE>
<ENDATE></ENDDATE>
<CATALOG>
<CD>
Create an XML document for the Oracle Starter Database Tables (i.e., emp, dept, ord, product, price)....
Create an XML document for the Oracle Starter Database Tables (i.e., emp, dept, ord, product, price). Each XML document must be in the format as described in the "Mapping tables to XML" section on pg. 1161 (any column that does not have a value can be displayed as empty, e.g., <DEGREE></DEGREE> ). The name for each document will be the name of the table followed by ".xml" as the file extension (e.g., "emp.xml"). Data for PRODUCT Table: CREATE TABLE PRODUCT...
Create an XML document for the Oracle Starter Database Tables (i.e., emp, dept, ord, product, price). Each XML document must be in the format as described in the "Mapping tables to XML" section on pg. 1161 (any column that does not have a value can be displayed as empty, e.g., <DEGREE></DEGREE> ). The name for each document will be the name of the table followed by ".xml" as the file extension (e.g., "emp.xml"). Data for the Bonus table: CREATE TABLE...
Create an XML document for the Oracle Starter Database Tables (i.e., emp, dept, ord, product, price). Each XML document must be in the format as described in the "Mapping tables to XML" section on pg. 1161 (any column that does not have a value can be displayed as empty, e.g., <DEGREE></DEGREE> ). The name for each document will be the name of the table followed by ".xml" as the file extension (e.g., "emp.xml"). Data for dept. table CREATE TABLE DEPT...
SQL: CREATE STATEMENT For patients whose last name matches the name entered by the user, display their first name, phone number, and doctor's name. Note: Try Davis. (TEXT FOR DATABASE BELOW) DROP TABLE PATIENT; DROP TABLE BILLING; DROP TABLE DOCTOR; CREATE TABLE DOCTOR( DOC_ID VARCHAR2(10) NOT NULL, DOC_NAME VARCHAR2(20), DATEHIRED DATE, SALPERMON NUMBER(8), AREA VARCHAR2(20), SUPERVISOR_ID NUMBER(8), CHGPERAPPT NUMBER(8), ANNUAL_BONUS NUMBER(8), PRIMARY KEY (DOC_ID) ); INSERT INTO DOCTOR VALUES('432', 'Harrison', to_date('05-DEC-1994','dd-mon-yyyy'), 12000, 'Pediatrics', 100, 75, 4500); INSERT INTO DOCTOR VALUES('509',...
SQL - create statement for query For each patient, display his or her last name, first name, and the name of his or her doctor. For each pediatrics patient, display his or her ID and his or her doctor's ID and name. For each doctor, display the name and the name of the doctor's supervisor in alphabetic order of supervisor's name. Include column aliases for clarity. Note: Check for accuracy. For each doctor in one of the two areas entered...
Q2. Retrieve the names of all employees from the employee table to produce output on CSV format or delimited format with a common delimeter, rather than separete columns. Hint:Put the whole row into a string with a semicolon as the seperator(delimeter) between thecolumns: FORMAT:(fname;minit;lname) Example: EMPLOYEES -------------- James;E;Borg Frank;T;Wong Q3. Write a query to show the employees name from the employee table in this format: first letter of the first name, followed by a dot, a blank, and the full...
oracle only
database:
DROP TABLE ORDERITEMS;
DROP TABLE Orders;
DROP TABLE BOOKAUTHOR;
DROP TABLE BOOKS;
DROP TABLE PROMOTION;
DROP TABLE AUTHOR;
DROP TABLE CUSTOMERS;
DROP TABLE PUBLISHER;
CREATE TABLE Customers
( Customer# NUMBER(4),
LastName VARCHAR2(10) NOT NULL,
FirstName VARCHAR2(10) NOT NULL,
Email VARCHAR(40),
Address VARCHAR2(20),
City VARCHAR2(12),
State VARCHAR2(2),
Zip VARCHAR2(5),
Referred NUMBER(4),
Region CHAR(2),
CONSTRAINT customers_customer#_pk PRIMARY KEY(customer#)
);
INSERT INTO CUSTOMERS
VALUES (1001, 'MORALES', 'BONITA', 'bomor@gmail.com', 'P.O.
BOX 651', 'EASTPOINT', 'FL', '32328', NULL, 'SE');
INSERT INTO CUSTOMERS
VALUES...
Query #2: List the name of the project and total number of hours worked on by all the employees on this project, also report the number of employees working on each project. Database: //STEP #1: CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary decimal(10,2), Super_ssn char(9), dno char(4), primary key (ssn)); CREATE TABLE department ( dname varchar(25) not null, dnumber char(4), Mgr_ssn char(9) not null,...
Query 1: Retrieve names of all the projects as well as First and Last name of managers if they are working on any of these projects. Database: //STEP #1: CREATE TABLE employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary decimal(10,2), Super_ssn char(9), dno char(4), primary key (ssn)); CREATE TABLE department ( dname varchar(25) not null, dnumber char(4), Mgr_ssn char(9) not null, Mgr_start_date date, primary key (dnumber)); CREATE...
Oracle 12c SQL Chapter 12 Determine which orders were shipped to the same state as order 1014. CREATE TABLE Orders (Order# NUMBER(4), Customer# NUMBER(4), OrderDate DATE NOT NULL, ShipDate DATE, ShipStreet VARCHAR2(18), ShipCity VARCHAR2(15), ShipState VARCHAR2(2), ShipZip VARCHAR2(5), ShipCost NUMBER(4,2), CONSTRAINT orders_order#_pk PRIMARY KEY(order#), CONSTRAINT orders_customer#_fk FOREIGN KEY (customer#) REFERENCES customers(customer#)); INSERT INTO ORDERS VALUES (1000,1005,TO_DATE('31-MAR-09','DD-MON-YY'),TO_DATE('02-APR-09','DD-MON-YY'),'1201 ORANGE AVE', 'SEATTLE', 'WA', '98114' , 2.00); INSERT INTO ORDERS VALUES (1001,1010,TO_DATE('31-MAR-09','DD-MON-YY'),TO_DATE('01-APR-09','DD-MON-YY'), '114 EAST SAVANNAH', 'ATLANTA', 'GA', '30314', 3.00); INSERT INTO ORDERS VALUES (1002,1011,TO_DATE('31-MAR-09','DD-MON-YY'),TO_DATE('01-APR-09','DD-MON-YY'),'58...