CISC 7510X Midterm Exam For the below questions, use the following schema definition.

Similar documents
2. (5 points) Who was John Doe s driver on April 1st, 2018?

SQL Practice Questions

Part 1. Part 2. airports100.csv contains a list of 100 US airports.

Solutions to Examination in Databases (TDA357/DIT620)

Identification Numbers. Chapter 9

SWEN502 Foundations of Databases Session 2. Victoria University of Wellington, 2017, Term 2 Markus Luczak-Roesch

Asynchronous Query Execution

Origin & Destination Report

FINAL EXAM: DATABASES ("DATABASES") 22/06/2010 SCHEMA

Tool: Overbooking Ratio Step by Step

Performance Indicator Horizontal Flight Efficiency

Query formalisms for relational model relational algebra

Airline Scheduling Optimization ( Chapter 7 I)

ELOQUA INTEGRATION GUIDE

CSCE 520 Final Exam Thursday December 14, 2017

Project 2 Database Design and ETL

Fundamentals of Airline Markets and Demand Dr. Peter Belobaba

Travel Resource Workbook

Introduction to Data Management CSE 344

Do Not Write Below Question Maximum Possible Points Score Total Points = 100

Big Data: Architectures and Data Analytics

Towards New Metrics Assessing Air Traffic Network Interactions

EZ Travel Form. General Tips for using the EZ Travel Form 1. Enable Excel Macros. 2. Always use the Tab key to move between fields when entering data.

myldtravel USER GUIDE

COMPARATIVE STUDY ON GROWTH AND FINANCIAL PERFORMANCE OF JET AIRWAYS, INDIGO AIRLINES & SPICEJET AIRLINES COMPANIES IN INDIA

myidtravel Functional Description

Vista Vista consultation workshop. 23 October 2017 Frequentis, Vienna

Year 9 Mathematics Examination SEMESTER

The regional value of tourism in the UK: 2013

Myth Busting MyTravel. Kim Coleman and Nancy Herbst 26, March 2014

10 - Relational Data and Joins

MIS 0855 Data Science (Section 006) Fall 2017 In-Class Exercise (Day 27-28) Visualizing Network

Global formulas. Page1. Video filmed with GeneXus X Evolution 2

Ranking Senators w/ Ted Kennedy s Votes

Network Revenue Management

ACI-NA BUSINESS TERM SURVEY APRIL 2017

My Trip to Seattle Teacher Sample Assignment

DATA APPLICATION CATEGORY 25 FARE BY RULE

Regional Spread of Inbound Tourism. VisitBritain Research, August 2018

The System User Manual

Internal aggregation models on the comb

Non residents boost hotel activity

Session: Travel Agency Activities (ISIC 7911)

New Zealand Transport Outlook. Leg-Based Air Passenger Model. November 2017

IT S JUST NOT NEEDED

Concur Travel - Frequently Asked Questions

Steep increases in overnight stays and revenue

Lesson: Seat Assignments General Description

Introduction to Business Statistics I Homework # 2

New Zealand Transport Outlook. Origin and Destination-Based International Air Passenger Model. November 2017

Bundled Sell Utility for Application Developers MODULE 202 REVISION

Be fast with fares. Be first with customers

Handling Transfers in Travel Booster

FareStar Ticket Window Product Functionality Guide

International Tourism Snapshot

Significant increases in overnight stays and revenue

Fold the lower corner up to touch the vertical middle crease. The fold starts from the opposite corner.

Scalable Runtime Support for Data-Intensive Applications on the Single-Chip Cloud Computer

Easter boosts results in tourism accommodation

If any rules are not clearly defined in English, the German original shall serve as masterversion.

Project 2 Database Design and ETL

GUN CASES. At Leapers, we put our efforts not only into designing the most

Pre-Calculus AB: Topics and Assignments Weeks 1 and 2

Rs. 22,999 onwards. Fascinating Andaman SUMMER VACATIONS Nights / 6 Days

Algebra 1 EOC Exam Study Guide. Directions: Please choose the best answer choice for each of the following questions. 1. Find the quotient.

Simplification Using Map Method

Airline network optimization. Lufthansa Consulting s approach

Frequently asked questions (FAQ)

Modeling Airline Fares

e-airportslots Tutorial

Original Research Paper DETERMINATION OF HAND FROM A FINGERPRINT

Egnatia Odos Observatory. Egnatia Odos Observatory Monitoring of Egnatia Motorway s s Spatial Impacts

Transportation Timetabling

Virginia Medicaid Web Portal Provider Maintenance Frequently Asked Questions Revised 02/20/2015. FAQ Contents. General Questions

Interactive x-via web analyses and simulation tool.

Accompanied Travel Enhancements. Product Advisory. May 11, 2007

B. Congestion Trends. Congestion Trends

2014 IATA GLOBAL PASSENGER SURVEY

Impacts of Visitor Spending on the Local Economy: George Washington Birthplace National Monument, 2004

Day 01 : Arrive at Kathmandu airport and transfer to hotel ( No meals): Day 02 : Fly to Pokhara, Drive to Nayapul and trek to Jhinu dada (B, L, D):

KILLINGTON, VERMONT, USA

BP s impact on the economy in. A report by Oxford Economics December 2017

Course Project. 1. Let staff make entries when a passenger makes reservations on a flight.

Germany Travel Guide

Aircom User Guide. Version 2. Site Navigation Tips and Shortcuts Steps to Commission Search

Solutions. Note, because landing and take-off arrivals are not staggered, all taking-off aeroplanes wait for 2 minutes before entering the runway.

my.scouting Tools Version 1 Overview Log In and Access Camping Manager

Improved Seat Reservation Functionality in Worldspan

The Luxury of Personalized Air Travel..

Incentives and Competition in the Airline Industry

SENIOR CERTIFICATE EXAMINATIONS

Organizing CLF Replenishment Events into CLF Voyages The CLF Voyages Template. Jason P. Jordan

SERVICE NETWORK DESIGN: APPLICATIONS IN TRANSPORTATION AND LOGISTICS

Model Solutions. ENGR 110: Test 2. 2 Oct, 2014

San Francisco Travel Association Citywide Customer Advisory Council Meeting. August 21, 2014

Investor Update July 24, 2007

Kristina Ricks ISYS 520 VBA Project Write-up Around the World

The Seychelles National Meteorological Services. Mahé Seychelles

Royal Parks Stakeholder Research Programme 2014

REPORT. VisitEngland Business Confidence Monitor Wave 5 Autumn

Transcription:

CISC 7510X Midterm Exam For the below questions, use the following schema definition. traveler(tid,fname,lname,ktn) flight(fid,airline,flightno,srcairport,destairport,departtim,landtim,coachprice) itinerary(iid,tid,timstamp) itineraryitem(iid,fid,price,seat) It is a schema for an airline, with travelers, flights, and itineraries that link travelers to flights. Each itinerary can have multiple flight legs, which are in itineraryitem table. Pick the best answer that fits the question. Not all of the answers may be correct. If none of the answers fit, write your own answer. There are more than 2 questions where you have to write your own answer. 1. (5 points) Find traveler id (tid) of traveler John Doe. (a) select lname,fname from traveler where fname= John and lname= Doe (b) select tid from itinerary where fname= John and lname= Doe (c) select tid from traveler where fname= John and lname= Doe (d) select tid from traveler inner join itineraryitem using(tid) where fname= John and lname= Doe 2. (5 points) Find the average price of a coach ticket. (a) select avg(price) from purchaseitem (b) select avg(coachprice) from flight (c) select avg(coachprice) from itinerary (d) select avg(price) from flight 3. (5 points) Find number of itineraries by traveler. (a) select tid,count(*) from itinerary natural inner join itineraryitem group by tid (b) select fid,count(*) from itineraryitem group by fid (c) select iid,count(*) from itineraryitem group by iid (d) select tid,count(*) from itinerary group by tid 4. (5 points) Find all flights for traveler John Doe. (a) select count(*) from traveler a natural inner join itinerary b natural inner join itineraryitem c where a.lname= Doe and a.fname= John (b) select flightno,srcairport,departtim from traveler a natural inner join itinerary b natural inner join itineraryitem c natural inner join flight d where a.lname= Doe and a.fname= John group by flightno,srcairport,departtim (c) select flightno,srcairport,departtim from traveler a natural inner join itinerary d where a.lname= Doe and a.fname= John group by flightno,srcairport,departtim 1

(d) select distinct flightno,srcairport,departtim from traveler a natural inner join itinerary d where a.lname= Doe and a.fname= John 5. (5 points) Find all itineraries that total more than $5000. (a) select iid from itinerary a natural inner join itineraryitem b group by iid having sum(price) > 5000 (b) select iid from itinerary a natural inner join itineraryitem b where price > 5000 group by iid (c) select iid from traveler a inner join itinerary a natural inner join itineraryitem b where price > 5000 group by iid (d) select iid from itineraryitem b where price > 5000 6. (5 points) Find travelers who have never purchased any flights. (a) select a.* from traveler a natural inner join itinerary b where b.iid is null (b) select a.* from traveler a left join itineraryitem b on a.tid=b.tid where b.iid=0 (c) select a.* from traveler a inner join itinerary b on a.tid=b.tid where b.iid > 0 (d) select a.* from traveler a natural left outer join itinerary b where b.iid is null 7. (5 points) Find top 10 travelers who spent the most in 2014. (a) select top 10 tid from itinerary a natural inner join itineraryitem b where timstamp >= 20140101 and timstamp < 20150101 (b) select tid from itinerary a natural inner join itineraryitem b where timstamp >= 20140101 and timstamp < 20150101 order by sum(price) desc (c) select tid,row number() over (order by sum(price) desc) rn from itinerary a natural inner join itineraryitem b where timstamp >= 20140101 and timstamp < 20150101 and rn <= 10 (d) select tid,sum(price) v from itinerary a natural inner join itineraryitem b where timstamp >= 20140101 and timstamp < 20150101 group by tid order by 2 desc limit 10 8. (5 points) What is the most appropriate index for traveler.lname field? (b) Bitmap Index 9. (5 points) What is the most appropriate index for traveler.tid field? 2

(b) Bitmap Index 10. (5 points) What is the most appropriate index for itinerary.iid field? (b) Bitmap Index 11. (5 points) The below code (tip: write out the first few output numbers): with recursive n(n) as ( select 2 n union all select n+1 from n where n<1000 ) select a.n from n a left join n b on b.n < sqrt(a.n) group by a.n having a.n=2 or min(a.n % b.n) > 0 (a) Is invalid (b) Will generate a list of numbers 1 to 1000 (c) Will create a table with all odd numbers from 1 to 1000 (d) Will output list of all prime numbers between 1 and 1000 12. (5 points) Find average number of flights per itinerary. (a) select avg(itinerary) from traveler a natural inner join itinerary b (b) select avg(*) from traveler a natural inner join itinerary b where tid > 0 (c) select avg(cnt) from (select iid,count(*) cnt from itinerary a natural inner join itineraryitem b group by iid) a (d) select avg( sum(1.0) ) over () from traveler a 13. (5 points) Find tickets that were bought on sale (listed price is higher than purchase price). (a) select * from flight a natural inner join itineraryitem b where coachprice > price (b) select * from flight a natural inner join itineraryitem b group by iid having coachprice > price (c) select count(*) from flight a natural inner join itineraryitem b group by iid having coachprice > price 3

(d) select * from itineraryitem b where coachprice > price 14. (5 points) Find the latest sale price for each flight. (a) select distinct fid,max(price) ls from itineraryitem order by timstamp (b) select distinct fid,max(timstamp) over (partition by fid order by price) ls from itineraryitem (c) select distinct fid,last value(price) over (partition by fid order by timstamp) ls from itineraryitem (d) select distinct fid,last value(price) over (partition by fid order by timstamp) ls from itinerary i natural inner join itineraryitem ii 15. (5 points) Find percentage of itineraries with above average costs. (a) select row number() over () / count(*) from itinerary a inner join itineraryitem b where price > avg(price) (b) select iid,sum(price) px, avg( sum(price) ) over () avgpx itinerary a inner join itineraryitem b where px > avgpx (c) select percentage(price) from itineraryitem where price > avg(price) (d) select sum(case when price>avg() then 1.0 else NULL end) / sum(1.0) from itinerary inner join itineraryitem 16. (5 points) Find all travelers who were booked for flight ABC123 during the first month of 2015. (a) select * from traveler where flightno = ABC123 (b) select * from traveler inner join itinerary inner join itineraryitem where flightno= ABC123 (c) select * from itinerary inner join itineraryitem where flightno= ABC123 (d) select distinct * from itineraryitem inner join traveler using(tid) having flightno= ABC123 17. (5 points) Find travelers who booked flight ABC123 and also XYZ789. (a) select * from traveler where flightno in ( ABC123, XYZ789 ) (b) select * from traveler inner join itineraryitem on tid and flightno in ( ABC123, XYZ789 ) (c) select tid from itinerary where flightno in ( ABC123, XYZ789 ) (d) select tid from itinerary a inner join itineraryitem inner join itinerary b inner join itineraryitem where a.flightno= ABC123 and b.flightno= XYZ789 18. (5 points) In general, on limited memory system, no indexes, and huge tables, what join type would perform best? (a) merge join. (b) hash join. 4

(c) indexed lookup join. (d) inner loop join. 19. (5 points) For traveler inner join itinerary, and no indexes, most modern databases will perform: (a) merge join. (b) hash join. (c) indexed lookup join. (d) inner loop join. 20. (5 points) When should bitmap indexes be used? (a) When clustered indexes are not appropriate. (b) If a column has many distinct values. (c) Only on columns with few distinct values. (d) All of the above. 5