Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Booking(agent: String, traveler ssn: integer, trip id: integer) FormedBy(id: integer, location: String, start date: Date, end date: Date) Goes On(ssn: integer, id: integer) Leg(location: String,
Booking(agent: String, traveler ssn: integer, trip id: integer) FormedBy(id: integer, location: String, start date: Date, end date: Date) Goes On(ssn: integer, id: integer) Leg(location: String, start date: Date, end date: Date) Owns(ssn: integer, passport number: integer, country: String) Passport(number: integer, country: String, expiration_date: Date, owner: String) TravelAgent(name: String, years experience: integer, phone: String) Traveller(name: String, ssn: integer, dob: Date) Trip(id: integer, start location: String, end location: String, start_date: Date, end date: Date) Exercises 1. [3 pts] Using SQL, find the name(s) of the travel agent(s) through whom the traveler 'pete' has booked trips. 2. (pts] Find the name(s) and phone(s) of the agent(s) who have booked the most trips. (a) Using relational algebra (b) Create the expression tree of your relational algebra (c) Using SQL 3. Find the average number of legs for all trips. (a) Using Relational Algebra (b) Create the expression tree of your relational algebra (c) Using SQL 4. Find name(s) of the Traveler(s) who have been on the greatest number of distinct trips. Note, distinct trips are based upon location pairs and not dates of travel. (a) Using Relational Algebra (b) Create the expression tree of your relational algebra (c) Using SQL Booking(agent: String, traveler ssn: integer, trip id: integer) FormedBy(id: integer, location: String, start date: Date, end date: Date) Goes On(ssn: integer, id: integer) Leg(location: String, start date: Date, end date: Date) Owns(ssn: integer, passport number: integer, country: String) Passport(number: integer, country: String, expiration_date: Date, owner: String) TravelAgent(name: String, years experience: integer, phone: String) Traveller(name: String, ssn: integer, dob: Date) Trip(id: integer, start location: String, end location: String, start_date: Date, end date: Date) Exercises 1. [3 pts] Using SQL, find the name(s) of the travel agent(s) through whom the traveler 'pete' has booked trips. 2. (pts] Find the name(s) and phone(s) of the agent(s) who have booked the most trips. (a) Using relational algebra (b) Create the expression tree of your relational algebra (c) Using SQL 3. Find the average number of legs for all trips. (a) Using Relational Algebra (b) Create the expression tree of your relational algebra (c) Using SQL 4. Find name(s) of the Traveler(s) who have been on the greatest number of distinct trips. Note, distinct trips are based upon location pairs and not dates of travel. (a) Using Relational Algebra (b) Create the expression tree of your relational algebra (c) Using SQL
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started