Docsity

SQL JOIN INNER OUTER AND FULL, Lab Reports of Database Management Systems (DBMS)

Toggle sidebar
bg1
NUST
Military College of Signals,
Rawalpindi.
DATABASE SYSTEM
LAB#9
BATCH-26C
Submitted By:
Aymen Fatima
CMS ID:
345556
Submitted To:
Sir Kabeer Ahmed
DEPARTMENT OF COMPUTER SOFTWARE ENGINEERING.
MILITARY COLLEGE OF SIGNALS.
EXPERIMENT 9 โ€“ JOIN Inner/Outer/Full/Self
pf3
pf4
pf5

Partial preview of the text

Download SQL JOIN INNER OUTER AND FULL and more Lab Reports Database Management Systems (DBMS) in PDF only on Docsity!

NUST

Military College of Signals,

Rawalpindi.

DATABASE SYSTEM

LAB#

BATCH-26C

Submitted By:

Aymen Fatima

CMS ID:

Submitted To:

Sir Kabeer Ahmed

DEPARTMENT OF COMPUTER SOFTWARE ENGINEERING.

MILITARY COLLEGE OF SIGNALS.

EXPERIMENT 9 โ€“ JOIN Inner/Outer/Full/Self

Problem 9.1 :

Write a query to output the name, city for each customer, even if there is no event

requested.

Select C.CustName,C.CustNo,CustCity,EventNo from Customer as C

left outer join EventRequest as E

on E.CustNo = C.CustNo

Problem 9.2 :

Display the details of those customer who has same estimated cost.

Select * from Customer as C

inner join EventRequest as E

on E.CustNo = C.CustNo

where E.Estcost IN (Select Ev.Estcost from EventRequest as Ev

where Ev.EventNo != E.EventNo)

Customer custno custname address Internal contact phone city state zip C100 Faisal Naseer Box 352200 Yes Mary Manager 6857100 Boulder CO 80309 C101 Mubashir Nazir Box 352400 Yes Sally Supervisor 5431700 Boulder CO 80309 C103 Babar Nawaz Box 352020 Yes Bill Baseball 5431234 Boulder CO 80309 C104 Waheed Iqbal Box 351200 Yes Sue Softball 5434321 Boulder CO 80309 C105 Hashir Shahid 123 AnyStreet No Coach Bob 4441234 Louisville CO 80027 Employee empno empname department email phone E100 Chuck Coordinator Administration [email protected] 3- E101 Mary Manager Football [email protected] 5- E102 Sally Supervisor Planning [email protected] 3- E103 Alan Administrator Administration [email protected] 3- Facility facno facname F100 Football stadium F101 Basketball arena F102 Baseball field F103 Recreation room Location

P102 E105 05-Dec-2018 Standard operation Operation E P103 E106 12-Dec-2018 Watch for seat switching Operation P104 E101 26-Oct-2018 Standard cleanup Cleanup E P105 E100 25-Oct-2018 Light cleanup Cleanup E P199 E102 10-Dec-2018 Standard operation Operation E P299 E101 26-Oct-2018 Operation E P349 E106 12-Dec-2018 Cleanup E P85 E100 25-Oct-2018 Standard operation Setup E P95 E101 26-Oct-2018 Extra security Setup E Primary and Foreign Keys

The primary and foreign keys are depicted in Figure 1. An event request is related to many (one or

more) event plans but only one customer. An event plan contains many event plan lines but only

one supervising employee. An event plan line references a resource and location. A facility has

many locations, but a location is specific to a facility.

Figure 1: Oracle Relational Database Diagram for the Intercollegiate Athletic Database