SlideShare a Scribd company logo
1 of 26
/* the following SPOOL command will capture the results of
*/
/* running this script in a SPOOL file name */
/* f:SLQ_Output_zero_for_Chap7.LST */
/* Note that the file is on a USB jumpdrive with a drive */
/* letter of f: */
/* The name assigned to this spool is not special in any way. */
/* You can assign any name to the file. The .LST file */
/* extension will be automatically added by the SPOOL process
*/
SPOOL f:SQL_Output_zero_for_Chap7;
/* Step-0 used to create and load textbook Chapter 7 tables */
DROP TABLE TBL_PRJ_EMPLOYEE;
DROP TABLE TBL_PRJ_CLIENT;
DROP TABLE TBL_PRJ_CAR;
DROP TABLE TBL_PRJ_MECHANIC;
/* Step-1 CREATE EMPLOYEE TABLE*/
CREATE TABLE TBL_PRJ_EMPLOYEE (
EMP_ID CHAR(10) PRIMARY KEY,
EMP_FNAME CHAR(15) NOT NULL,
EMP_LNAME CHAR(15) NOT NULL,
EMP_PHONE_NUMBER CHAR(10) NOT NULL,
EMP_ZIPCODE CHAR(5) NOT NULL,
CLIENT_ID CHAR(10) PRIMARY KEY,
C_PRICE VARCHAR(70) NOT NULL,
/* Step-2 CREATE ClIENT TABLE*/
CREATE TABLE TBL_PRJ_CLIENT (
CLIENT_ID CHAR(10) PRIMARY KEY,
CLIENT_FNAME CHAR(15) NOT NULL,
CLIENT_LNAME CHAR(15) NOT NULL,
CLIENT_PHONE_NUMBER CHAR(10) NOT NULL,
CLIENT_ZIPCODE CHAR(5) NOT NULL,
FOREIGN KEY (CLIENT_ID) REFERENCES
TBL_PRJ_EMPLOYEE(CLIENT_ID),
/* Step-3 Create CAR table */
CREATE TABLE TBL_PRJ_CAR (
C_MAKE INTEGER PRIMARY KEY,
C_MODEL INTEGER PRIMARY KEY,
C_MAKE VARCHAR(70) NOT NULL,
C_MODEL VARCHAR(70) NOT NULL,
C_PRICE VARCHAR(70) NOT NULL,
C_YEAR VARCHAR(4) NOT NULL,
C_MPG VARCHAR(3) NOT NULL,
FOREIGN KEY (C_PRICE) REFERENCES
TBL_PRJ_EMPLOYEE(C_PRICE),
/* Step-4 Create MECHANIC table */
CREATE TABLE TBL_PRJ_CLIENT (
MECHA_ID CHAR(10) PRIMARY KEY,
MECHA_FNAME CHAR(15) NOT NULL,
MECHA_LNAME CHAR(15) NOT NULL,
MECHA_EXTENSION CHAR(10) NOT NULL,
MECHA_COST CHAR(10) NOT NULL,
/* Step-5 Create INDEX table */
CREATE INDEX CLIE_INLNAME ON
TBL_PRJ_CLIENT(CLIENT_LNAME);
CREATE INDEX CA_MODEL ON
TBL_PRJ_CAR(CAR_MODEL);
/* Step-6 INSERT MECHANIC table */
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1001','FRANCK','YEBOUE','614424514','43221','14253');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1002','JEFF','LO','614412515','43231','24587');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1011','HADJI','SECK','614524516','43220','35689');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1451','DARKO','MILIC','61824517','43227','1425');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1003','ANTHONY','BABEN','614224518','43228','125');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1781','GORA','SECK','614624519','43320','7896');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1401','IBRA','MOVIC','614424510','43221','14256');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1511','EZIQUEL','LAVEZZI','614724511','43229','478');
INSERT INTO TBL_PRJ_MECHANIC VALUES
('1004','JEAN','CLAUDE','614824512','43226',9654');
/* Step-7 INSERT EMPLOYEE table */
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2001','ousseyn','sagna','614424114','43221','3001','5000');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2011','marco','verati','614624316','43228','3003','2000');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2011','alice','Sy','614524316','43220','3011','17000');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2451','Daniel','ribery','61424417','43226','3781','27597');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2003','vick','robben','614224618','43227','3401','22000');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2781','jake','miller','614624719','43327'.'3511','20562');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2401','javier','pastore','614424810','43224','3004','31456');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2511','savatore','sirigu','614724911','43223','3451','25047');
INSERT INTO TBL_PRJ_EMPLOYEE VALUES
('2004','siaka','tiene','614827812','43222','3002','4789');
/* Step-8 INSERT CLIENT table */
INSERT INTO TBL_PRJ_CLIENT VALUES
('3001','MAMADOU','SAKHO','615424514','43221','14253');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3002','THIAGO','SYLVA','494412515','46231','24587');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3011','ALEX','MOTTA','617524516','43220','35689');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3451','VICTOR','HUGO','62824517','43223','1425');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3003','DEEQ','GOONER','914224518','43228','125');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3781','LUCAS','MOURA','496624519','45320','7896');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3401','CLEMENT','CHAMTOME','221424510','48221','14256')
;
INSERT INTO TBL_PRJ_CLIENT VALUES
('3511','LIONEL','MESSI','615724511','46229','478');
INSERT INTO TBL_PRJ_CLIENT VALUES
('3004','RONALDO','DEJUAN','617824512','44226',9654');
/* Step-9 INSERT CAR INFO */
INSERT INTO TBL_PRJ_CAR VALUES ('Mitsubishi', 'Galant',
'5000','2004','159');
INSERT INTO TBL_PRJ_CAR VALUES ('Cadillac', 'CTS',
'17000','2010', 57);
INSERT INTO TBL_PRJ_CAR VALUES ('Ford', 'Ranger XL',
'11000''2008', 112);
INSERT INTO TBL_PRJ_CAR VALUES ('mecedez', 'Mclaren',
'10000','2006', 98);
INSERT INTO TBL_PRJ_CAR VALUES ('Honda', 'Insight',
'12000','2005', 56);
INSERT INTO TBL_PRJ_CAR VALUES ('MINI Cooper', 'S',
'23267','2002', 31);
INSERT INTO TBL_PRJ_CAR VALUES ('Mitsubishi', 'Eclipse
GS', '14818','2013', 30);
INSERT INTO TBL_PRJ_CAR VALUES ('Pontiac', 'G6 GT',
'27597','2013', 24);
INSERT INTO TBL_PRJ_CAR VALUES ('Toyota', 'Camry
Hybrid', '31456','2013', 34);
INSERT INTO TBL_PRJ_CAR VALUES ('CHEVY ', 'Camaro',
'20562','2006', 25);
/* STEP 10 SELECT CONTENT TBL*/
SELECT * FROM TBL_PRJ_CAR;
SELECT * FROM TBL_PRJ_EMPLOYEE;
SELECT * FROM TBL_PRJ_CLIENT;
SELECT * FROM TBL_PRJ_MECHANIC;
/* step 11 join queries*/
SELECT
CLIENT_FNAME,CLIENT_LNAME,CLIENT.ZIPCODE,
EMP_FNAME, EMP_ZIPCODE FROM TBL_PRJ_CLIENT,
TBL_PRJ_EMPLOYEE
WHERE CLIENT.ZIPCODE = EMP.ZIP_CODE;
/* STEP 12 SELECT MAX CAR PRICE */
SELECT make, model FROM TBL_PRJ_CAR;
WHERE C.price = (SELECT MAX (price) FROM
TBL_PRJ_CAR);
/* step 13 car price superior to 20000 */
SELECT C_MODEL,C_MAKE,C_PRICE, FROM
TBL_PRJ_EMPLOYEE;
TBL_PRJ_CAR;
WHERE CAR.C_PRICE = EMPLOYEE.C_PRICE
AND C_YEAR = '2013'
AND C_PRICE > 20000
/*TOTAL CAR PRICE*/
SELECT SUM(C_PRICE) AS TOTAL_C_PRICE
FROM TBL_PRJ_CAR
Section 4: IMPLEMENTATION
· SQL Commands and their output:
· Used to create tables
> /* Step-0 used to create and load Assign03_3_5 tables */
/* CREATE TABLE TRAVEL */
> CREATE TABLE TBL_PRJ_TRAVEL (
TRV_CODE NUMBER(5) PRIMARY KEY,
TRV_DESTINATION VARCHAR(20) NOT NULL,
TRV_ORIGIN VARCHAR(20) NOT NULL,
TRV_DATE_START DATE NOT NULL)
CREATE TABLE succeeded.
/* CREATE TABLE PASSENGER */
> CREATE TABLE TBL_PRJ_PASSENGER (
PASSENGER_ID VARCHAR(20) PRIMARY KEY,
PASSENGER_FN VARCHAR(25) NOT NULL,
PASSENGER_LN VARCHAR(20) NOT NULL,
ENFANT_or_ADULT VARCHAR(6) NOT NULL,
Handicapped VARCHAR(3) NOT NULL)
CREATE TABLE succeeded.
/* CREATE TABLE BAGGAGE */
> CREATE TABLE TBL_PRJ_BAGGAGE (
BAG_NUM NUMBER(8) PRIMARY KEY,
PASSENGER_ID VARCHAR(20) NOT NULL,
BAG_WEIGHT NUMBER(2) NOT NULL,
BAG_OVERWEIGHT NUMBER(3) NOT NULL,
PAYMENT_METHOD VARCHAR(10) NOT NULL,
FOREIGN KEY (PASSENGER_ID) REFERENCES
TBL_PRJ_PASSENGER(PASSENGER_ID))
CREATE TABLE succeeded.
/* CREATE TABLE SEAT */
> CREATE TABLE TBL_PRJ_SEAT (
SEAT_NUM VARCHAR(5) PRIMARY KEY,
AISLE VARCHAR(1) NOT NULL)
CREATE TABLE succeeded.
/* CREATE TABLE TICKET */
> CREATE TABLE TBL_PRJ_TICKET (
TICKET_NUM NUMBER(6) PRIMARY KEY,
TICKET_PRICE NUMBER(9,2) DEFAULT 0.00 NOT NULL,
TRV_CODE NUMBER(5) NOT NULL,
SEAT_NUM VARCHAR(5) NOT NULL,
TRV_DATE_ARRIVAL DATE NOT NULL,
FOREIGN KEY (TRV_CODE) REFERENCES
TBL_PRJ_TRAVEL(TRV_CODE),
FOREIGN KEY (SEAT_NUM) REFERENCES
TBL_PRJ_SEAT(SEAT_NUM))
CREATE TABLE succeeded.
· Used to create indexes and / or sequences, if appropriate
No index and / or sequences
· Used to insert initial sample data into all tables
/* INSERT VALUES INTO TABLE TRAVEL */
> /* TRAVEL rows */
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00001,'DELWARE','AKRON','04-NOV-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00002,'COLUMBUS','CLEVELAND','06-JUN-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00003,'CLEVELAND','CINCINATTI','07-JUL-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00004,'AKRON','CIRCLEVILLE','12-DEC-10')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00005,'DAYTON','COLUMBUS','01-JAN-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00006,'PITTSBURG','COLUMBUS','03-MAR-10')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00007,'CINCINATTI','DELWARE','07-APR-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TRAVEL VALUES
(00008,'CIRCLEVILLE','PITTSBURG','06-MAY-12')
1 rows inserted
/* INSERT VALUES INTO TABLE PASSENGER */
> /* PASSENGER rows */
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1321','FRANCK','YEBOUE','ADULT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1331','YANNICK','HARRIS','ADULT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1341','ROGER','BRIAN','ADULT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1351','DOUGLAS','ROGER','ADULT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1361','HENRY','MOORE','ENFANT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1371','LIZ','ZEN','ADULT','YES')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1381','NENE','DORA','ADULT','NO')
1 rows inserted
> INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR-
#1301','HELEN','LEWIS','ENFANT','NO')
1 rows inserted
/* INSERT VALUES INTO TABLE BAGGAGE */
> /* BAGGAGE rows */
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00001123,'PASSGR-#1361',14,000,'CASH')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00001124,'PASSGR-#1321',00,000,'CASH')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00001125,'PASSGR-#1371',23,013,'CREDIT')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00001126,'PASSGR-#1331',17,000,'DEBIT')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00001127,'PASSGR-#1301',03,000,'CASH')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00007728,'PASSGR-#1341',12,000,'CREDIT')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00009929,'PASSGR-#1381',01,000,'CASH')
1 rows inserted
> INSERT INTO TBL_PRJ_BAGGAGE VALUES
(00003630,'PASSGR-#1351',10,650,'CREDIT')
1 rows inserted
/* INSERT VALUES INTO TABLE SEAT */
> /* SEAT rows */
> INSERT INTO TBL_PRJ_SEAT VALUES ('A-001','A')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('A-003','A')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('B-001','A')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('B-002','B')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('B-003','B')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('A-017','A')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('B-030','B')
1 rows inserted
> INSERT INTO TBL_PRJ_SEAT VALUES ('C-008','C')
1 rows inserted
/* INSERT VALUES INTO TABLE TICKET */
> /* TICKET rows */
> INSERT INTO TBL_PRJ_TICKET VALUES
('002021',45.23,00001,'A-001','04-NOV-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002022',42.32,00002,'A-003','06-JUN-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002023',14.93,00003,'B-001','07-JUL-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002024',63.24,00004,'B-002','12-DEC-10')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002025',58.36,00005,'C-008','01-JAN-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002026',43.25,00006,'B-030','03-MAR-10')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002027',78.56,00007,'A-017','07-APR-11')
1 rows inserted
> INSERT INTO TBL_PRJ_TICKET VALUES
('002028',35.45,00008,'B-003','06-MAY-12')
1 rows inserted
· Used to list the contents of all tables after inserting the initial
sample data
> /* CONTENT OF TABLE TRAVEL*/
> SELECT * FROM TBL_PRJ_TRAVEL
TRV_CODE TRV_DESTINATION TRV_ORIGIN
TRV_DATE_START
---------------------- -------------------- -------------------- ----------
---------------
1 DELWARE AKRON 04-NOV-11
2 COLUMBUS CLEVELAND 06-JUN-11
3 CLEVELAND CINCINATTI 07-JUL-11
4 AKRON CIRCLEVILLE 12-DEC-10
5 DAYTON COLUMBUS 01-JAN-11
6 PITTSBURG COLUMBUS 03-MAR-10
7 CINCINATTI DELWARE 07-APR-11
8 CIRCLEVILLE PITTSBURG 06-MAY-12
8 rows selected
> /* CONTENT OF TABLE TPASSENGER*/
> SELECT * FROM TBL_PRJ_PASSENGER
PASSENGER_ID PASSENGER_FN PASSENGER_LN
ENFANT_OR_ADULT HANDICAPPED
-------------------- ------------------------- -------------------- -------
-------- -----------
PASSGR-#1321 FRANCK YEBOUE ADULT NO
PASSGR-#1331 YANNICK HARRIS ADULT NO
PASSGR-#1341 ROGER BRIAN ADULT NO
PASSGR-#1351 DOUGLAS ROGER ADULT NO
PASSGR-#1361 HENRY MOORE ENFANT NO
PASSGR-#1371 LIZ ZEN ADULT YES
PASSGR-#1381 NENE DORA ADULT NO
PASSGR-#1301 HELEN LEWIS ENFANT NO
8 rows selected
> /* CONTENT OF TABLE BAGGAGE*/
> SELECT * FROM TBL_PRJ_BAGGAGE
BAG_NUM PASSENGER_ID BAG_WEIGHT
BAG_OVERWEIGHT PAYMENT_METHOD
---------------------- -------------------- ---------------------- --------
-------------- --------------
1123 PASSGR-#1361 14 0 CASH
1124 PASSGR-#1321 0 0 CASH
1125 PASSGR-#1371 23 13 CREDIT
1126 PASSGR-#1331 17 0 DEBIT
1127 PASSGR-#1301 3 0 CASH
7728 PASSGR-#1341 12 0 CREDIT
9929 PASSGR-#1381 1 0 CASH
3630 PASSGR-#1351 10 650 CREDIT
8 rows selected
> /* CONTENT OF TABLE SEAT */
> SELECT * FROM TBL_PRJ_SEAT
SEAT_NUM AISLE
-------- -----
A-001 A
A-003 A
B-001 A
B-002 B
B-003 B
A-017 A
B-030 B
C-008 C
8 rows selected
> /* CONTENT OF TABLE TICKET */
> SELECT * FROM TBL_PRJ_TICKET
TICKET_NUM TICKET_PRICE TRV_CODE SEAT_NUM
TRV_DATE_ARRIVAL
---------------------- ---------------------- ---------------------- ------
-- -------------------------
2021 45.23 1 A-001 04-NOV-11
2022 42.32 2 A-003 06-JUN-11
2023 14.93 3 B-001 07-JUL-11
2024 63.24 4 B-002 12-DEC-10
2025 58.36 5 C-008 01-JAN-11
2026 43.25 6 B-030 03-MAR-10
2027 78.56 7 A-017 07-APR-11
2028 35.45 8 B-003 06-MAY-12
8 rows selected
· Used to produce basic system queries including table joins
> /*WANT TO KNOW EACH PASSENGER AND THE
BAGGAGE NUMBER THAT HE/SHE POSSESSES */
> SELECT PASSENGER_FN, PASSENGER_LN,
P.PASSENGER_ID, BAG_NUM
FROM TBL_PRJ_PASSENGER P, TBL_PRJ_BAGGAGE D
WHERE P.PASSENGER_ID = D.PASSENGER_ID
ORDER BY P.PASSENGER_LN
PASSENGER_FN PASSENGER_LN PASSENGER_ID
BAG_NUM
------------------------- -------------------- -------------------- -------
---------------
ROGER BRIAN PASSGR-#1341 7728
NENE DORA PASSGR-#1381 9929
YANNICK HARRIS PASSGR-#1331 1126
HELEN LEWIS PASSGR-#1301 1127
HENRY MOORE PASSGR-#1361 1123
DOUGLAS ROGER PASSGR-#1351 3630
FRANCK YEBOUE PASSGR-#1321 1124
LIZ ZEN PASSGR-#1371 1125
8 rows selected
> /*WANT TO KNOW THE DESTINATIONS AND THE PRICE
FOR THE TRIP FOR TICKETS THAT ARE MORE THAN
$25*/
> SELECT TICKET_PRICE, TRV_DATE_START,
TRV_DATE_ARRIVAL, T.TRV_CODE
FROM TBL_PRJ_TICKET T , TBL_PRJ_TRAVEL V
WHERE T.TRV_CODE = V.TRV_CODE
AND T.TICKET_PRICE > 50
TICKET_PRICE TRV_DATE_START TRV_DATE_ARRIVAL
TRV_CODE
---------------------- ------------------------- -------------------------
----------------------
63.24 12-DEC-10 12-DEC-10 4
58.36 01-JAN-11 01-JAN-11 5
78.56 07-APR-11 07-APR-11 7
· Used to create manager view
> /* CREATE A MANAGER VIEW THAT SELECT
COMPLETE INFORMATION FROM TABLES */
> CREATE VIEW MANAGER AS (
SELECT TICKET_NUM, V.TRV_CODE, S.SEAT_NUM,
AISLE, TRV_DESTINATION, TRV_ORIGIN, TICKET_PRICE
FROM TBL_PRJ_TICKET T, TBL_PRJ_SEAT S,
TBL_PRJ_TRAVEL V
WHERE S.SEAT_NUM = T.SEAT_NUM
AND V.TRV_CODE = T.TRV_CODE)
CREATE VIEW succeeded.
> /* DISPLAY THE MANAGER'S VIEW CREATED */
> SELECT * FROM MANAGER
TICKET_NUM TRV_CODE SEAT_NUM AISLE
TRV_DESTINATION TRV_ORIGIN TICKET_PRICE
---------------------- ---------------------- -------- ----- ---------------
----- -------------------- ----------------------
2021 1 A-001 A DELWARE AKRON 45.23
2022 2 A-003 A COLUMBUS CLEVELAND 42.32
2023 3 B-001 A CLEVELAND CINCINATTI 14.93
2024 4 B-002 B AKRON CIRCLEVILLE 63.24
2025 5 C-008 C DAYTON COLUMBUS 58.36
2026 6 B-030 B PITTSBURG COLUMBUS 43.25
2027 7 A-017 A CINCINATTI DELWARE 78.56
2028 8 B-003 B CIRCLEVILLE PITTSBURG 35.45
8 rows selected
· Used to create an updateable view for data entry purposes
> /* CREATE AN UPDATEABLE VIEW */
> CREATE VIEW UPDATEABLE_V AS (
SELECT BAG_NUM, P.PASSENGER_ID , PASSENGER_FN,
PASSENGER_LN, BAG_WEIGHT ,BAG_OVERWEIGHT ,
PAYMENT_METHOD, Handicapped
FROM TBL_PRJ_PASSENGER P, TBL_PRJ_BAGGAGE B
WHERE P.PASSENGER_ID = B.PASSENGER_ID)
CREATE VIEW succeeded.
> /* DISPLAY DATA IN THE UPDATEABLE VIEW */
> SELECT * FROM UPDATEABLE_V
BAG_NUM PASSENGER_ID PASSENGER_FN
PASSENGER_LN BAG_WEIGHT BAG_OVERWEIGHT
PAYMENT_METHOD HANDICAPPED
---------------------- -------------------- ------------------------- -----
--------------- ---------------------- ---------------------- -------------
- -----------
1123 PASSGR-#1361 HENRY MOORE 14 0 CASH NO
1124 PASSGR-#1321 FRANCK YEBOUE 0 0 CASH NO
1125 PASSGR-#1371 LIZ ZEN 23 13 CREDIT YES
1126 PASSGR-#1331 YANNICK HARRIS 17 0 DEBIT NO
1127 PASSGR-#1301 HELEN LEWIS 3 0 CASH NO
7728 PASSGR-#1341 ROGER BRIAN 12 0 CREDIT NO
9929 PASSGR-#1381 NENE DORA 1 0 CASH NO
3630 PASSGR-#1351 DOUGLAS ROGER 10 650 CREDIT NO
8 rows selected
> /* UPDATE CUSTOMERS USING THE UPDATEABLE
VIEW CREATED */
> /* SHOW THE DATA WE WANT TO UPDATE */
> SELECT BAG_NUM, PASSENGER_ID, BAG_WEIGHT,
BAG_OVERWEIGHT, PAYMENT_METHOD
FROM TBL_PRJ_BAGGAGE
WHERE PASSENGER_ID = 'PASSGR-#1371'
OR PAYMENT_METHOD = 'CREDIT'
BAG_NUM PASSENGER_ID BAG_WEIGHT
BAG_OVERWEIGHT PAYMENT_METHOD
---------------------- -------------------- ---------------------- --------
-------------- --------------
1125 PASSGR-#1371 23 13 CREDIT
7728 PASSGR-#1341 12 0 CREDIT
3630 PASSGR-#1351 10 650 CREDIT
> /* UPDATE DATA USING THE UPDATEABLE VIEW */
> UPDATE UPDATEABLE_V
SET PAYMENT_METHOD = 'DEBIT'
WHERE PASSENGER_ID = 'PASSGR-#1371'
1 rows updated
> /*CHECK IF THE DATA WAS UPDATED */
> SELECT BAG_NUM, PASSENGER_ID, BAG_WEIGHT,
BAG_OVERWEIGHT, PAYMENT_METHOD
FROM TBL_PRJ_BAGGAGE
WHERE PASSENGER_ID = 'PASSGR-#1371'
OR PAYMENT_METHOD = 'DEBIT'
BAG_NUM PASSENGER_ID BAG_WEIGHT
BAG_OVERWEIGHT PAYMENT_METHOD
---------------------- -------------------- ---------------------- --------
-------------- --------------
1125 PASSGR-#1371 23 13 DEBIT
1126 PASSGR-#1331 17 0 DEBIT
· Used to create roles that define access privileges
Access privileges and limits for the tables in this database will
be set-up by the DBA after the database is implemented and
tested.
· Used to create reports with headers / footers / column
headings / page numbers
> /* CREATE reports with headers / footers / column headings /
page numbers */
> CREATE VIEW MANAGER AS (
SELECT TICKET_NUM, V.TRV_CODE, S.SEAT_NUM,
AISLE, TRV_DESTINATION, TRV_ORIGIN, TICKET_PRICE
FROM TBL_PRJ_TICKET T, TBL_PRJ_SEAT S,
TBL_PRJ_TRAVEL V
WHERE S.SEAT_NUM = T.SEAT_NUM
AND V.TRV_CODE = T.TRV_CODE)
CREATE VIEW succeeded.
> /* DISPLAY THE MANAGER'S VIEW CREATED */
> SELECT * FROM MANAGER
TICKET_NUM TRV_CODE SEAT_NUM AISLE
TRV_DESTINATION TRV_ORIGIN TICKET_PRICE
---------------------- ---------------------- -------- ----- ---------------
----- -------------------- ----------------------
2021 1 A-001 A DELWARE AKRON 45.23
2022 2 A-003 A COLUMBUS CLEVELAND 42.32
2023 3 B-001 A CLEVELAND CINCINATTI 14.93
2024 4 B-002 B AKRON CIRCLEVILLE 63.24
2025 5 C-008 C DAYTON COLUMBUS 58.36
2026 6 B-030 B PITTSBURG COLUMBUS 43.25
2027 7 A-017 A CINCINATTI DELWARE 78.56
2028 8 B-003 B CIRCLEVILLE PITTSBURG 35.45
8 rows selected

More Related Content

Similar to the following SPOOL command will capture the results of .docx

Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application DevelopmentSaurabh K. Gupta
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxclarkjanyce
 
1582627
15826271582627
1582627tabish
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
 
Please follow the cod eand comments for description CODE #incl.pdf
Please follow the cod eand comments for description CODE #incl.pdfPlease follow the cod eand comments for description CODE #incl.pdf
Please follow the cod eand comments for description CODE #incl.pdfannaielectronicsvill
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Thuan Nguyen
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid listNur Khoiri
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docxajoy21
 
New SQL features in latest MySQL releases
New SQL features in latest MySQL releasesNew SQL features in latest MySQL releases
New SQL features in latest MySQL releasesGeorgi Sotirov
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxmetriohanzel
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docxAdamq0DJonese
 
#include iostream #include string #include fstream std.docx
#include iostream #include string #include fstream  std.docx#include iostream #include string #include fstream  std.docx
#include iostream #include string #include fstream std.docxajoy21
 
Applications of the DOW loop
Applications of the DOW loop Applications of the DOW loop
Applications of the DOW loop Murphy Choy
 
I need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docxI need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docxhendriciraida
 
C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfflashfashioncasualwe
 
Trigger and cursor program using sql
Trigger and cursor program using sqlTrigger and cursor program using sql
Trigger and cursor program using sqlSushil Mishra
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon ExportAnar Godjaev
 

Similar to the following SPOOL command will capture the results of .docx (20)

Oracle: PLSQL Commands
Oracle: PLSQL CommandsOracle: PLSQL Commands
Oracle: PLSQL Commands
 
PL-SQL.pdf
PL-SQL.pdfPL-SQL.pdf
PL-SQL.pdf
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application Development
 
Oracle
OracleOracle
Oracle
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docx
 
1582627
15826271582627
1582627
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 
Please follow the cod eand comments for description CODE #incl.pdf
Please follow the cod eand comments for description CODE #incl.pdfPlease follow the cod eand comments for description CODE #incl.pdf
Please follow the cod eand comments for description CODE #incl.pdf
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid list
 
#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx#include iostream #include string#includeiomanip using.docx
#include iostream #include string#includeiomanip using.docx
 
New SQL features in latest MySQL releases
New SQL features in latest MySQL releasesNew SQL features in latest MySQL releases
New SQL features in latest MySQL releases
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
 
#include iostream #include string #include fstream std.docx
#include iostream #include string #include fstream  std.docx#include iostream #include string #include fstream  std.docx
#include iostream #include string #include fstream std.docx
 
Applications of the DOW loop
Applications of the DOW loop Applications of the DOW loop
Applications of the DOW loop
 
I need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docxI need help with implementing the priority queue data structure with a.docx
I need help with implementing the priority queue data structure with a.docx
 
C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdf
 
Trigger and cursor program using sql
Trigger and cursor program using sqlTrigger and cursor program using sql
Trigger and cursor program using sql
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon Export
 

More from MARRY7

Part 1.....InstructionsSelect one of the age groups disc.docx
Part 1.....InstructionsSelect one of the age groups disc.docxPart 1.....InstructionsSelect one of the age groups disc.docx
Part 1.....InstructionsSelect one of the age groups disc.docxMARRY7
 
Part 1 – Add to Website PlanList at least three .docx
Part 1 – Add to Website PlanList at least three .docxPart 1 – Add to Website PlanList at least three .docx
Part 1 – Add to Website PlanList at least three .docxMARRY7
 
Part 1 True or False Questions. (10 questions at 1 point each).docx
Part 1 True or False Questions. (10 questions at 1 point each).docxPart 1 True or False Questions. (10 questions at 1 point each).docx
Part 1 True or False Questions. (10 questions at 1 point each).docxMARRY7
 
Part 11. Why is it so important in system engineering to become .docx
Part 11. Why is it so important in system engineering to become .docxPart 11. Why is it so important in system engineering to become .docx
Part 11. Why is it so important in system engineering to become .docxMARRY7
 
Part 1 Using the internet, search for commercial IDPS systems. What.docx
Part 1 Using the internet, search for commercial IDPS systems. What.docxPart 1 Using the internet, search for commercial IDPS systems. What.docx
Part 1 Using the internet, search for commercial IDPS systems. What.docxMARRY7
 
Part 1- Create an outline of the assignment below thenPart 2-1000 .docx
Part 1- Create an outline of the assignment below thenPart 2-1000 .docxPart 1- Create an outline of the assignment below thenPart 2-1000 .docx
Part 1- Create an outline of the assignment below thenPart 2-1000 .docxMARRY7
 
Part 1 Review QuestionsWhat is the difference between criminal la.docx
Part 1 Review QuestionsWhat is the difference between criminal la.docxPart 1 Review QuestionsWhat is the difference between criminal la.docx
Part 1 Review QuestionsWhat is the difference between criminal la.docxMARRY7
 
Part 1 Review QuestionsWhat is the difference between authenticat.docx
Part 1 Review QuestionsWhat is the difference between authenticat.docxPart 1 Review QuestionsWhat is the difference between authenticat.docx
Part 1 Review QuestionsWhat is the difference between authenticat.docxMARRY7
 
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docx
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docxPart 1 SQLDatabase workScenarioDevelopment of a relationa.docx
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docxMARRY7
 
Part 1 Review QuestionsWhat functions constitute a complete infor.docx
Part 1 Review QuestionsWhat functions constitute a complete infor.docxPart 1 Review QuestionsWhat functions constitute a complete infor.docx
Part 1 Review QuestionsWhat functions constitute a complete infor.docxMARRY7
 
Part 1A persons lifestyle has a significant influence on the p.docx
Part 1A persons lifestyle has a significant influence on the p.docxPart 1A persons lifestyle has a significant influence on the p.docx
Part 1A persons lifestyle has a significant influence on the p.docxMARRY7
 
Part 1 Review QuestionsWhat is the definition of information secu.docx
Part 1 Review QuestionsWhat is the definition of information secu.docxPart 1 Review QuestionsWhat is the definition of information secu.docx
Part 1 Review QuestionsWhat is the definition of information secu.docxMARRY7
 
Part 1 Review QuestionsWhat is a security modelWhat are the es.docx
Part 1 Review QuestionsWhat is a security modelWhat are the es.docxPart 1 Review QuestionsWhat is a security modelWhat are the es.docx
Part 1 Review QuestionsWhat is a security modelWhat are the es.docxMARRY7
 
Part 1 Listed below are several key Supreme Court decisions that .docx
Part 1 Listed below are several key Supreme Court decisions that .docxPart 1 Listed below are several key Supreme Court decisions that .docx
Part 1 Listed below are several key Supreme Court decisions that .docxMARRY7
 
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docx
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docxPart 1 Infrastructure DesignCreate an 8–10-page infrastructur.docx
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docxMARRY7
 
part 1 I attended an international conference on Biotechnology and .docx
part 1 I attended an international conference on Biotechnology and .docxpart 1 I attended an international conference on Biotechnology and .docx
part 1 I attended an international conference on Biotechnology and .docxMARRY7
 
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docx
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docxPart 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docx
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docxMARRY7
 
Parent Involvement Plan This week you will create a Parent Involve.docx
Parent Involvement Plan This week you will create a Parent Involve.docxParent Involvement Plan This week you will create a Parent Involve.docx
Parent Involvement Plan This week you will create a Parent Involve.docxMARRY7
 
Parenting Practices Over GenerationsGeneration 1 Years children.docx
Parenting Practices Over GenerationsGeneration 1 Years children.docxParenting Practices Over GenerationsGeneration 1 Years children.docx
Parenting Practices Over GenerationsGeneration 1 Years children.docxMARRY7
 
ParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxMARRY7
 

More from MARRY7 (20)

Part 1.....InstructionsSelect one of the age groups disc.docx
Part 1.....InstructionsSelect one of the age groups disc.docxPart 1.....InstructionsSelect one of the age groups disc.docx
Part 1.....InstructionsSelect one of the age groups disc.docx
 
Part 1 – Add to Website PlanList at least three .docx
Part 1 – Add to Website PlanList at least three .docxPart 1 – Add to Website PlanList at least three .docx
Part 1 – Add to Website PlanList at least three .docx
 
Part 1 True or False Questions. (10 questions at 1 point each).docx
Part 1 True or False Questions. (10 questions at 1 point each).docxPart 1 True or False Questions. (10 questions at 1 point each).docx
Part 1 True or False Questions. (10 questions at 1 point each).docx
 
Part 11. Why is it so important in system engineering to become .docx
Part 11. Why is it so important in system engineering to become .docxPart 11. Why is it so important in system engineering to become .docx
Part 11. Why is it so important in system engineering to become .docx
 
Part 1 Using the internet, search for commercial IDPS systems. What.docx
Part 1 Using the internet, search for commercial IDPS systems. What.docxPart 1 Using the internet, search for commercial IDPS systems. What.docx
Part 1 Using the internet, search for commercial IDPS systems. What.docx
 
Part 1- Create an outline of the assignment below thenPart 2-1000 .docx
Part 1- Create an outline of the assignment below thenPart 2-1000 .docxPart 1- Create an outline of the assignment below thenPart 2-1000 .docx
Part 1- Create an outline of the assignment below thenPart 2-1000 .docx
 
Part 1 Review QuestionsWhat is the difference between criminal la.docx
Part 1 Review QuestionsWhat is the difference between criminal la.docxPart 1 Review QuestionsWhat is the difference between criminal la.docx
Part 1 Review QuestionsWhat is the difference between criminal la.docx
 
Part 1 Review QuestionsWhat is the difference between authenticat.docx
Part 1 Review QuestionsWhat is the difference between authenticat.docxPart 1 Review QuestionsWhat is the difference between authenticat.docx
Part 1 Review QuestionsWhat is the difference between authenticat.docx
 
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docx
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docxPart 1 SQLDatabase workScenarioDevelopment of a relationa.docx
Part 1 SQLDatabase workScenarioDevelopment of a relationa.docx
 
Part 1 Review QuestionsWhat functions constitute a complete infor.docx
Part 1 Review QuestionsWhat functions constitute a complete infor.docxPart 1 Review QuestionsWhat functions constitute a complete infor.docx
Part 1 Review QuestionsWhat functions constitute a complete infor.docx
 
Part 1A persons lifestyle has a significant influence on the p.docx
Part 1A persons lifestyle has a significant influence on the p.docxPart 1A persons lifestyle has a significant influence on the p.docx
Part 1A persons lifestyle has a significant influence on the p.docx
 
Part 1 Review QuestionsWhat is the definition of information secu.docx
Part 1 Review QuestionsWhat is the definition of information secu.docxPart 1 Review QuestionsWhat is the definition of information secu.docx
Part 1 Review QuestionsWhat is the definition of information secu.docx
 
Part 1 Review QuestionsWhat is a security modelWhat are the es.docx
Part 1 Review QuestionsWhat is a security modelWhat are the es.docxPart 1 Review QuestionsWhat is a security modelWhat are the es.docx
Part 1 Review QuestionsWhat is a security modelWhat are the es.docx
 
Part 1 Listed below are several key Supreme Court decisions that .docx
Part 1 Listed below are several key Supreme Court decisions that .docxPart 1 Listed below are several key Supreme Court decisions that .docx
Part 1 Listed below are several key Supreme Court decisions that .docx
 
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docx
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docxPart 1 Infrastructure DesignCreate an 8–10-page infrastructur.docx
Part 1 Infrastructure DesignCreate an 8–10-page infrastructur.docx
 
part 1 I attended an international conference on Biotechnology and .docx
part 1 I attended an international conference on Biotechnology and .docxpart 1 I attended an international conference on Biotechnology and .docx
part 1 I attended an international conference on Biotechnology and .docx
 
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docx
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docxPart 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docx
Part 1 Chapter 7 Summary plus end of chapter discussion of Alfred.docx
 
Parent Involvement Plan This week you will create a Parent Involve.docx
Parent Involvement Plan This week you will create a Parent Involve.docxParent Involvement Plan This week you will create a Parent Involve.docx
Parent Involvement Plan This week you will create a Parent Involve.docx
 
Parenting Practices Over GenerationsGeneration 1 Years children.docx
Parenting Practices Over GenerationsGeneration 1 Years children.docxParenting Practices Over GenerationsGeneration 1 Years children.docx
Parenting Practices Over GenerationsGeneration 1 Years children.docx
 
ParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docxParamsThe interface must be pleasing to look at (a basic form wit.docx
ParamsThe interface must be pleasing to look at (a basic form wit.docx
 

Recently uploaded

Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 

Recently uploaded (20)

Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 

the following SPOOL command will capture the results of .docx

  • 1. /* the following SPOOL command will capture the results of */ /* running this script in a SPOOL file name */ /* f:SLQ_Output_zero_for_Chap7.LST */ /* Note that the file is on a USB jumpdrive with a drive */ /* letter of f: */ /* The name assigned to this spool is not special in any way. */ /* You can assign any name to the file. The .LST file */ /* extension will be automatically added by the SPOOL process */ SPOOL f:SQL_Output_zero_for_Chap7; /* Step-0 used to create and load textbook Chapter 7 tables */ DROP TABLE TBL_PRJ_EMPLOYEE; DROP TABLE TBL_PRJ_CLIENT; DROP TABLE TBL_PRJ_CAR;
  • 2. DROP TABLE TBL_PRJ_MECHANIC; /* Step-1 CREATE EMPLOYEE TABLE*/ CREATE TABLE TBL_PRJ_EMPLOYEE ( EMP_ID CHAR(10) PRIMARY KEY, EMP_FNAME CHAR(15) NOT NULL, EMP_LNAME CHAR(15) NOT NULL, EMP_PHONE_NUMBER CHAR(10) NOT NULL, EMP_ZIPCODE CHAR(5) NOT NULL, CLIENT_ID CHAR(10) PRIMARY KEY, C_PRICE VARCHAR(70) NOT NULL,
  • 3. /* Step-2 CREATE ClIENT TABLE*/ CREATE TABLE TBL_PRJ_CLIENT ( CLIENT_ID CHAR(10) PRIMARY KEY, CLIENT_FNAME CHAR(15) NOT NULL, CLIENT_LNAME CHAR(15) NOT NULL, CLIENT_PHONE_NUMBER CHAR(10) NOT NULL, CLIENT_ZIPCODE CHAR(5) NOT NULL, FOREIGN KEY (CLIENT_ID) REFERENCES TBL_PRJ_EMPLOYEE(CLIENT_ID), /* Step-3 Create CAR table */ CREATE TABLE TBL_PRJ_CAR ( C_MAKE INTEGER PRIMARY KEY, C_MODEL INTEGER PRIMARY KEY, C_MAKE VARCHAR(70) NOT NULL, C_MODEL VARCHAR(70) NOT NULL,
  • 4. C_PRICE VARCHAR(70) NOT NULL, C_YEAR VARCHAR(4) NOT NULL, C_MPG VARCHAR(3) NOT NULL, FOREIGN KEY (C_PRICE) REFERENCES TBL_PRJ_EMPLOYEE(C_PRICE), /* Step-4 Create MECHANIC table */ CREATE TABLE TBL_PRJ_CLIENT ( MECHA_ID CHAR(10) PRIMARY KEY, MECHA_FNAME CHAR(15) NOT NULL, MECHA_LNAME CHAR(15) NOT NULL, MECHA_EXTENSION CHAR(10) NOT NULL, MECHA_COST CHAR(10) NOT NULL,
  • 5. /* Step-5 Create INDEX table */ CREATE INDEX CLIE_INLNAME ON TBL_PRJ_CLIENT(CLIENT_LNAME); CREATE INDEX CA_MODEL ON TBL_PRJ_CAR(CAR_MODEL); /* Step-6 INSERT MECHANIC table */ INSERT INTO TBL_PRJ_MECHANIC VALUES ('1001','FRANCK','YEBOUE','614424514','43221','14253'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1002','JEFF','LO','614412515','43231','24587'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1011','HADJI','SECK','614524516','43220','35689'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1451','DARKO','MILIC','61824517','43227','1425');
  • 6. INSERT INTO TBL_PRJ_MECHANIC VALUES ('1003','ANTHONY','BABEN','614224518','43228','125'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1781','GORA','SECK','614624519','43320','7896'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1401','IBRA','MOVIC','614424510','43221','14256'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1511','EZIQUEL','LAVEZZI','614724511','43229','478'); INSERT INTO TBL_PRJ_MECHANIC VALUES ('1004','JEAN','CLAUDE','614824512','43226',9654'); /* Step-7 INSERT EMPLOYEE table */ INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2001','ousseyn','sagna','614424114','43221','3001','5000'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2011','marco','verati','614624316','43228','3003','2000'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2011','alice','Sy','614524316','43220','3011','17000'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2451','Daniel','ribery','61424417','43226','3781','27597');
  • 7. INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2003','vick','robben','614224618','43227','3401','22000'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2781','jake','miller','614624719','43327'.'3511','20562'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2401','javier','pastore','614424810','43224','3004','31456'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2511','savatore','sirigu','614724911','43223','3451','25047'); INSERT INTO TBL_PRJ_EMPLOYEE VALUES ('2004','siaka','tiene','614827812','43222','3002','4789'); /* Step-8 INSERT CLIENT table */ INSERT INTO TBL_PRJ_CLIENT VALUES ('3001','MAMADOU','SAKHO','615424514','43221','14253'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3002','THIAGO','SYLVA','494412515','46231','24587'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3011','ALEX','MOTTA','617524516','43220','35689');
  • 8. INSERT INTO TBL_PRJ_CLIENT VALUES ('3451','VICTOR','HUGO','62824517','43223','1425'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3003','DEEQ','GOONER','914224518','43228','125'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3781','LUCAS','MOURA','496624519','45320','7896'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3401','CLEMENT','CHAMTOME','221424510','48221','14256') ; INSERT INTO TBL_PRJ_CLIENT VALUES ('3511','LIONEL','MESSI','615724511','46229','478'); INSERT INTO TBL_PRJ_CLIENT VALUES ('3004','RONALDO','DEJUAN','617824512','44226',9654'); /* Step-9 INSERT CAR INFO */ INSERT INTO TBL_PRJ_CAR VALUES ('Mitsubishi', 'Galant', '5000','2004','159'); INSERT INTO TBL_PRJ_CAR VALUES ('Cadillac', 'CTS',
  • 9. '17000','2010', 57); INSERT INTO TBL_PRJ_CAR VALUES ('Ford', 'Ranger XL', '11000''2008', 112); INSERT INTO TBL_PRJ_CAR VALUES ('mecedez', 'Mclaren', '10000','2006', 98); INSERT INTO TBL_PRJ_CAR VALUES ('Honda', 'Insight', '12000','2005', 56); INSERT INTO TBL_PRJ_CAR VALUES ('MINI Cooper', 'S', '23267','2002', 31); INSERT INTO TBL_PRJ_CAR VALUES ('Mitsubishi', 'Eclipse GS', '14818','2013', 30); INSERT INTO TBL_PRJ_CAR VALUES ('Pontiac', 'G6 GT', '27597','2013', 24); INSERT INTO TBL_PRJ_CAR VALUES ('Toyota', 'Camry Hybrid', '31456','2013', 34); INSERT INTO TBL_PRJ_CAR VALUES ('CHEVY ', 'Camaro', '20562','2006', 25); /* STEP 10 SELECT CONTENT TBL*/ SELECT * FROM TBL_PRJ_CAR;
  • 10. SELECT * FROM TBL_PRJ_EMPLOYEE; SELECT * FROM TBL_PRJ_CLIENT; SELECT * FROM TBL_PRJ_MECHANIC; /* step 11 join queries*/ SELECT CLIENT_FNAME,CLIENT_LNAME,CLIENT.ZIPCODE, EMP_FNAME, EMP_ZIPCODE FROM TBL_PRJ_CLIENT, TBL_PRJ_EMPLOYEE WHERE CLIENT.ZIPCODE = EMP.ZIP_CODE; /* STEP 12 SELECT MAX CAR PRICE */ SELECT make, model FROM TBL_PRJ_CAR; WHERE C.price = (SELECT MAX (price) FROM TBL_PRJ_CAR); /* step 13 car price superior to 20000 */
  • 11. SELECT C_MODEL,C_MAKE,C_PRICE, FROM TBL_PRJ_EMPLOYEE; TBL_PRJ_CAR; WHERE CAR.C_PRICE = EMPLOYEE.C_PRICE AND C_YEAR = '2013' AND C_PRICE > 20000 /*TOTAL CAR PRICE*/ SELECT SUM(C_PRICE) AS TOTAL_C_PRICE FROM TBL_PRJ_CAR Section 4: IMPLEMENTATION · SQL Commands and their output: · Used to create tables > /* Step-0 used to create and load Assign03_3_5 tables */ /* CREATE TABLE TRAVEL */
  • 12. > CREATE TABLE TBL_PRJ_TRAVEL ( TRV_CODE NUMBER(5) PRIMARY KEY, TRV_DESTINATION VARCHAR(20) NOT NULL, TRV_ORIGIN VARCHAR(20) NOT NULL, TRV_DATE_START DATE NOT NULL) CREATE TABLE succeeded. /* CREATE TABLE PASSENGER */ > CREATE TABLE TBL_PRJ_PASSENGER ( PASSENGER_ID VARCHAR(20) PRIMARY KEY, PASSENGER_FN VARCHAR(25) NOT NULL, PASSENGER_LN VARCHAR(20) NOT NULL, ENFANT_or_ADULT VARCHAR(6) NOT NULL, Handicapped VARCHAR(3) NOT NULL) CREATE TABLE succeeded. /* CREATE TABLE BAGGAGE */ > CREATE TABLE TBL_PRJ_BAGGAGE ( BAG_NUM NUMBER(8) PRIMARY KEY, PASSENGER_ID VARCHAR(20) NOT NULL, BAG_WEIGHT NUMBER(2) NOT NULL, BAG_OVERWEIGHT NUMBER(3) NOT NULL, PAYMENT_METHOD VARCHAR(10) NOT NULL, FOREIGN KEY (PASSENGER_ID) REFERENCES TBL_PRJ_PASSENGER(PASSENGER_ID)) CREATE TABLE succeeded. /* CREATE TABLE SEAT */ > CREATE TABLE TBL_PRJ_SEAT (
  • 13. SEAT_NUM VARCHAR(5) PRIMARY KEY, AISLE VARCHAR(1) NOT NULL) CREATE TABLE succeeded. /* CREATE TABLE TICKET */ > CREATE TABLE TBL_PRJ_TICKET ( TICKET_NUM NUMBER(6) PRIMARY KEY, TICKET_PRICE NUMBER(9,2) DEFAULT 0.00 NOT NULL, TRV_CODE NUMBER(5) NOT NULL, SEAT_NUM VARCHAR(5) NOT NULL, TRV_DATE_ARRIVAL DATE NOT NULL, FOREIGN KEY (TRV_CODE) REFERENCES TBL_PRJ_TRAVEL(TRV_CODE), FOREIGN KEY (SEAT_NUM) REFERENCES TBL_PRJ_SEAT(SEAT_NUM)) CREATE TABLE succeeded. · Used to create indexes and / or sequences, if appropriate No index and / or sequences · Used to insert initial sample data into all tables /* INSERT VALUES INTO TABLE TRAVEL */ > /* TRAVEL rows */ > INSERT INTO TBL_PRJ_TRAVEL VALUES (00001,'DELWARE','AKRON','04-NOV-11') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00002,'COLUMBUS','CLEVELAND','06-JUN-11')
  • 14. 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00003,'CLEVELAND','CINCINATTI','07-JUL-11') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00004,'AKRON','CIRCLEVILLE','12-DEC-10') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00005,'DAYTON','COLUMBUS','01-JAN-11') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00006,'PITTSBURG','COLUMBUS','03-MAR-10') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00007,'CINCINATTI','DELWARE','07-APR-11') 1 rows inserted > INSERT INTO TBL_PRJ_TRAVEL VALUES (00008,'CIRCLEVILLE','PITTSBURG','06-MAY-12') 1 rows inserted /* INSERT VALUES INTO TABLE PASSENGER */ > /* PASSENGER rows */ > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1321','FRANCK','YEBOUE','ADULT','NO') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1331','YANNICK','HARRIS','ADULT','NO')
  • 15. 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1341','ROGER','BRIAN','ADULT','NO') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1351','DOUGLAS','ROGER','ADULT','NO') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1361','HENRY','MOORE','ENFANT','NO') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1371','LIZ','ZEN','ADULT','YES') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1381','NENE','DORA','ADULT','NO') 1 rows inserted > INSERT INTO TBL_PRJ_PASSENGER VALUES ('PASSGR- #1301','HELEN','LEWIS','ENFANT','NO') 1 rows inserted /* INSERT VALUES INTO TABLE BAGGAGE */ > /* BAGGAGE rows */ > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00001123,'PASSGR-#1361',14,000,'CASH') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00001124,'PASSGR-#1321',00,000,'CASH')
  • 16. 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00001125,'PASSGR-#1371',23,013,'CREDIT') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00001126,'PASSGR-#1331',17,000,'DEBIT') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00001127,'PASSGR-#1301',03,000,'CASH') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00007728,'PASSGR-#1341',12,000,'CREDIT') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00009929,'PASSGR-#1381',01,000,'CASH') 1 rows inserted > INSERT INTO TBL_PRJ_BAGGAGE VALUES (00003630,'PASSGR-#1351',10,650,'CREDIT') 1 rows inserted /* INSERT VALUES INTO TABLE SEAT */ > /* SEAT rows */ > INSERT INTO TBL_PRJ_SEAT VALUES ('A-001','A') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('A-003','A') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('B-001','A')
  • 17. 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('B-002','B') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('B-003','B') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('A-017','A') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('B-030','B') 1 rows inserted > INSERT INTO TBL_PRJ_SEAT VALUES ('C-008','C') 1 rows inserted /* INSERT VALUES INTO TABLE TICKET */ > /* TICKET rows */ > INSERT INTO TBL_PRJ_TICKET VALUES ('002021',45.23,00001,'A-001','04-NOV-11') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002022',42.32,00002,'A-003','06-JUN-11') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002023',14.93,00003,'B-001','07-JUL-11') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002024',63.24,00004,'B-002','12-DEC-10')
  • 18. 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002025',58.36,00005,'C-008','01-JAN-11') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002026',43.25,00006,'B-030','03-MAR-10') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002027',78.56,00007,'A-017','07-APR-11') 1 rows inserted > INSERT INTO TBL_PRJ_TICKET VALUES ('002028',35.45,00008,'B-003','06-MAY-12') 1 rows inserted · Used to list the contents of all tables after inserting the initial sample data > /* CONTENT OF TABLE TRAVEL*/ > SELECT * FROM TBL_PRJ_TRAVEL TRV_CODE TRV_DESTINATION TRV_ORIGIN TRV_DATE_START ---------------------- -------------------- -------------------- ---------- --------------- 1 DELWARE AKRON 04-NOV-11 2 COLUMBUS CLEVELAND 06-JUN-11 3 CLEVELAND CINCINATTI 07-JUL-11 4 AKRON CIRCLEVILLE 12-DEC-10 5 DAYTON COLUMBUS 01-JAN-11 6 PITTSBURG COLUMBUS 03-MAR-10
  • 19. 7 CINCINATTI DELWARE 07-APR-11 8 CIRCLEVILLE PITTSBURG 06-MAY-12 8 rows selected > /* CONTENT OF TABLE TPASSENGER*/ > SELECT * FROM TBL_PRJ_PASSENGER PASSENGER_ID PASSENGER_FN PASSENGER_LN ENFANT_OR_ADULT HANDICAPPED -------------------- ------------------------- -------------------- ------- -------- ----------- PASSGR-#1321 FRANCK YEBOUE ADULT NO PASSGR-#1331 YANNICK HARRIS ADULT NO PASSGR-#1341 ROGER BRIAN ADULT NO PASSGR-#1351 DOUGLAS ROGER ADULT NO PASSGR-#1361 HENRY MOORE ENFANT NO PASSGR-#1371 LIZ ZEN ADULT YES PASSGR-#1381 NENE DORA ADULT NO PASSGR-#1301 HELEN LEWIS ENFANT NO 8 rows selected > /* CONTENT OF TABLE BAGGAGE*/ > SELECT * FROM TBL_PRJ_BAGGAGE BAG_NUM PASSENGER_ID BAG_WEIGHT BAG_OVERWEIGHT PAYMENT_METHOD ---------------------- -------------------- ---------------------- -------- -------------- -------------- 1123 PASSGR-#1361 14 0 CASH 1124 PASSGR-#1321 0 0 CASH 1125 PASSGR-#1371 23 13 CREDIT 1126 PASSGR-#1331 17 0 DEBIT
  • 20. 1127 PASSGR-#1301 3 0 CASH 7728 PASSGR-#1341 12 0 CREDIT 9929 PASSGR-#1381 1 0 CASH 3630 PASSGR-#1351 10 650 CREDIT 8 rows selected > /* CONTENT OF TABLE SEAT */ > SELECT * FROM TBL_PRJ_SEAT SEAT_NUM AISLE -------- ----- A-001 A A-003 A B-001 A B-002 B B-003 B A-017 A B-030 B C-008 C 8 rows selected > /* CONTENT OF TABLE TICKET */ > SELECT * FROM TBL_PRJ_TICKET TICKET_NUM TICKET_PRICE TRV_CODE SEAT_NUM TRV_DATE_ARRIVAL ---------------------- ---------------------- ---------------------- ------ -- ------------------------- 2021 45.23 1 A-001 04-NOV-11 2022 42.32 2 A-003 06-JUN-11 2023 14.93 3 B-001 07-JUL-11 2024 63.24 4 B-002 12-DEC-10
  • 21. 2025 58.36 5 C-008 01-JAN-11 2026 43.25 6 B-030 03-MAR-10 2027 78.56 7 A-017 07-APR-11 2028 35.45 8 B-003 06-MAY-12 8 rows selected · Used to produce basic system queries including table joins > /*WANT TO KNOW EACH PASSENGER AND THE BAGGAGE NUMBER THAT HE/SHE POSSESSES */ > SELECT PASSENGER_FN, PASSENGER_LN, P.PASSENGER_ID, BAG_NUM FROM TBL_PRJ_PASSENGER P, TBL_PRJ_BAGGAGE D WHERE P.PASSENGER_ID = D.PASSENGER_ID ORDER BY P.PASSENGER_LN PASSENGER_FN PASSENGER_LN PASSENGER_ID BAG_NUM ------------------------- -------------------- -------------------- ------- --------------- ROGER BRIAN PASSGR-#1341 7728 NENE DORA PASSGR-#1381 9929 YANNICK HARRIS PASSGR-#1331 1126 HELEN LEWIS PASSGR-#1301 1127 HENRY MOORE PASSGR-#1361 1123 DOUGLAS ROGER PASSGR-#1351 3630 FRANCK YEBOUE PASSGR-#1321 1124 LIZ ZEN PASSGR-#1371 1125 8 rows selected > /*WANT TO KNOW THE DESTINATIONS AND THE PRICE FOR THE TRIP FOR TICKETS THAT ARE MORE THAN $25*/
  • 22. > SELECT TICKET_PRICE, TRV_DATE_START, TRV_DATE_ARRIVAL, T.TRV_CODE FROM TBL_PRJ_TICKET T , TBL_PRJ_TRAVEL V WHERE T.TRV_CODE = V.TRV_CODE AND T.TICKET_PRICE > 50 TICKET_PRICE TRV_DATE_START TRV_DATE_ARRIVAL TRV_CODE ---------------------- ------------------------- ------------------------- ---------------------- 63.24 12-DEC-10 12-DEC-10 4 58.36 01-JAN-11 01-JAN-11 5 78.56 07-APR-11 07-APR-11 7 · Used to create manager view > /* CREATE A MANAGER VIEW THAT SELECT COMPLETE INFORMATION FROM TABLES */ > CREATE VIEW MANAGER AS ( SELECT TICKET_NUM, V.TRV_CODE, S.SEAT_NUM, AISLE, TRV_DESTINATION, TRV_ORIGIN, TICKET_PRICE FROM TBL_PRJ_TICKET T, TBL_PRJ_SEAT S, TBL_PRJ_TRAVEL V WHERE S.SEAT_NUM = T.SEAT_NUM AND V.TRV_CODE = T.TRV_CODE) CREATE VIEW succeeded. > /* DISPLAY THE MANAGER'S VIEW CREATED */ > SELECT * FROM MANAGER TICKET_NUM TRV_CODE SEAT_NUM AISLE
  • 23. TRV_DESTINATION TRV_ORIGIN TICKET_PRICE ---------------------- ---------------------- -------- ----- --------------- ----- -------------------- ---------------------- 2021 1 A-001 A DELWARE AKRON 45.23 2022 2 A-003 A COLUMBUS CLEVELAND 42.32 2023 3 B-001 A CLEVELAND CINCINATTI 14.93 2024 4 B-002 B AKRON CIRCLEVILLE 63.24 2025 5 C-008 C DAYTON COLUMBUS 58.36 2026 6 B-030 B PITTSBURG COLUMBUS 43.25 2027 7 A-017 A CINCINATTI DELWARE 78.56 2028 8 B-003 B CIRCLEVILLE PITTSBURG 35.45 8 rows selected · Used to create an updateable view for data entry purposes > /* CREATE AN UPDATEABLE VIEW */ > CREATE VIEW UPDATEABLE_V AS ( SELECT BAG_NUM, P.PASSENGER_ID , PASSENGER_FN, PASSENGER_LN, BAG_WEIGHT ,BAG_OVERWEIGHT , PAYMENT_METHOD, Handicapped FROM TBL_PRJ_PASSENGER P, TBL_PRJ_BAGGAGE B WHERE P.PASSENGER_ID = B.PASSENGER_ID) CREATE VIEW succeeded. > /* DISPLAY DATA IN THE UPDATEABLE VIEW */ > SELECT * FROM UPDATEABLE_V BAG_NUM PASSENGER_ID PASSENGER_FN PASSENGER_LN BAG_WEIGHT BAG_OVERWEIGHT PAYMENT_METHOD HANDICAPPED ---------------------- -------------------- ------------------------- -----
  • 24. --------------- ---------------------- ---------------------- ------------- - ----------- 1123 PASSGR-#1361 HENRY MOORE 14 0 CASH NO 1124 PASSGR-#1321 FRANCK YEBOUE 0 0 CASH NO 1125 PASSGR-#1371 LIZ ZEN 23 13 CREDIT YES 1126 PASSGR-#1331 YANNICK HARRIS 17 0 DEBIT NO 1127 PASSGR-#1301 HELEN LEWIS 3 0 CASH NO 7728 PASSGR-#1341 ROGER BRIAN 12 0 CREDIT NO 9929 PASSGR-#1381 NENE DORA 1 0 CASH NO 3630 PASSGR-#1351 DOUGLAS ROGER 10 650 CREDIT NO 8 rows selected > /* UPDATE CUSTOMERS USING THE UPDATEABLE VIEW CREATED */ > /* SHOW THE DATA WE WANT TO UPDATE */ > SELECT BAG_NUM, PASSENGER_ID, BAG_WEIGHT, BAG_OVERWEIGHT, PAYMENT_METHOD FROM TBL_PRJ_BAGGAGE WHERE PASSENGER_ID = 'PASSGR-#1371' OR PAYMENT_METHOD = 'CREDIT' BAG_NUM PASSENGER_ID BAG_WEIGHT BAG_OVERWEIGHT PAYMENT_METHOD ---------------------- -------------------- ---------------------- -------- -------------- -------------- 1125 PASSGR-#1371 23 13 CREDIT 7728 PASSGR-#1341 12 0 CREDIT 3630 PASSGR-#1351 10 650 CREDIT > /* UPDATE DATA USING THE UPDATEABLE VIEW */ > UPDATE UPDATEABLE_V SET PAYMENT_METHOD = 'DEBIT'
  • 25. WHERE PASSENGER_ID = 'PASSGR-#1371' 1 rows updated > /*CHECK IF THE DATA WAS UPDATED */ > SELECT BAG_NUM, PASSENGER_ID, BAG_WEIGHT, BAG_OVERWEIGHT, PAYMENT_METHOD FROM TBL_PRJ_BAGGAGE WHERE PASSENGER_ID = 'PASSGR-#1371' OR PAYMENT_METHOD = 'DEBIT' BAG_NUM PASSENGER_ID BAG_WEIGHT BAG_OVERWEIGHT PAYMENT_METHOD ---------------------- -------------------- ---------------------- -------- -------------- -------------- 1125 PASSGR-#1371 23 13 DEBIT 1126 PASSGR-#1331 17 0 DEBIT · Used to create roles that define access privileges Access privileges and limits for the tables in this database will be set-up by the DBA after the database is implemented and tested. · Used to create reports with headers / footers / column headings / page numbers > /* CREATE reports with headers / footers / column headings / page numbers */ > CREATE VIEW MANAGER AS ( SELECT TICKET_NUM, V.TRV_CODE, S.SEAT_NUM, AISLE, TRV_DESTINATION, TRV_ORIGIN, TICKET_PRICE FROM TBL_PRJ_TICKET T, TBL_PRJ_SEAT S, TBL_PRJ_TRAVEL V
  • 26. WHERE S.SEAT_NUM = T.SEAT_NUM AND V.TRV_CODE = T.TRV_CODE) CREATE VIEW succeeded. > /* DISPLAY THE MANAGER'S VIEW CREATED */ > SELECT * FROM MANAGER TICKET_NUM TRV_CODE SEAT_NUM AISLE TRV_DESTINATION TRV_ORIGIN TICKET_PRICE ---------------------- ---------------------- -------- ----- --------------- ----- -------------------- ---------------------- 2021 1 A-001 A DELWARE AKRON 45.23 2022 2 A-003 A COLUMBUS CLEVELAND 42.32 2023 3 B-001 A CLEVELAND CINCINATTI 14.93 2024 4 B-002 B AKRON CIRCLEVILLE 63.24 2025 5 C-008 C DAYTON COLUMBUS 58.36 2026 6 B-030 B PITTSBURG COLUMBUS 43.25 2027 7 A-017 A CINCINATTI DELWARE 78.56 2028 8 B-003 B CIRCLEVILLE PITTSBURG 35.45 8 rows selected