Given the following relational database schema: FLIGHT = (FlightN, FromCity, ToCity, Date, DepartureTime, ArrivalTime ) //...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given the following relational database schema: FLIGHT = (FlightN, FromCity, ToCity, Date, DepartureTime, ArrivalTime ) // You may use <, >, !=, or= between any two dates or between any two times. Also, you may assume the attribute Date = arrival date= departure date and that ToCity and FromCity are in the same time zone. • TICKET = (TicketN, FlightN, Cost, Completed) // Since Ticket# and Flight# together are the key, this means a single ticket may include several flights. Completed may assume the values 'Yes' or NULL, Null means the flight hasn't been completed. • PASSENGER = (Name, TicketN) // This table includes every passenger and the ticket numbers he or she purchased. Assume the name of the passenger is unique. Express the following queries as SQL statements using a minimum number of tables and operations: Retrieve the names of every passenger and total amount paid for the tickets he/she purchased. SELECT P.Name, countT.cost) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name; SELECT P.Name, count(*) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name; SELECT P.Name, Sum(T.cost) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name; Given the following relational database schema: FLIGHT = (FlightN, FromCity, ToCity, Date, DepartureTime, ArrivalTime ) // You may use <, >, !=, or= between any two dates or between any two times. Also, you may assume the attribute Date = arrival date= departure date and that ToCity and FromCity are in the same time zone. • TICKET = (TicketN, FlightN, Cost, Completed) // Since Ticket# and Flight# together are the key, this means a single ticket may include several flights. Completed may assume the values 'Yes' or NULL, Null means the flight hasn't been completed. • PASSENGER = (Name, TicketN) // This table includes every passenger and the ticket numbers he or she purchased. Assume the name of the passenger is unique. Express the following queries as SQL statements using a minimum number of tables and operations: Retrieve the names of every passenger and total amount paid for the tickets he/she purchased. SELECT P.Name, countT.cost) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name; SELECT P.Name, count(*) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name; SELECT P.Name, Sum(T.cost) FROM PASSENGER P, TICKET T WHERE P.TicketN= T.TicketN GROUP BY P.Name;
Expert Answer:
Answer rating: 100% (QA)
The correct option is c SQL SELECT PName SUM T Cost AS TotalAmount Paid FROM PASSENGER P JOIN TICKET ... View the full answer
Related Book For
Database Systems Design Implementation and Management
ISBN: 978-1337627900
13th edition
Authors: Carlos Coronel, Steven Morris
Posted Date:
Students also viewed these economics questions
-
After looking at this case, can you identify issues and alternatives and state major decisions to be made in this case? and after stating the problems, can you make a solution statement including the...
-
ConAir (CA) commercial airlines company requires you experience in database design and have approached you to assist in the design of their new airline database system. They urgently need to have...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Data from the registrar's office at Gigantic State University indicate that over the past 20 years tuition and enrollment have both increased. From this information we can conclude that: A. higher...
-
Find the orthogonal complement of the null space of A. (a) (b) 1-22 A=12 3 2 ] 416 1-1 327 A -4 7 8 2-2
-
7. (6 marks) Write a program togenerate 8 random integers in the range of 10 to 100 andask the user if they would like to choose the number ("y" for yes or "n" for no). Add only the numbers chosen to...
-
For each of the following situations, indicate the amount shown as a liability on the balance sheet of Cooper, Inc., at December 31: a. Cooper has accounts payable of \(\$ 120,000\) for merchandise...
-
Jim Wells, vice-president for manufacturing of the Northern Airplane Company, is exasperated. His walk through the companys most important plant this morning has left him in a foul mood. However, he...
-
Complete business activity and instalment activity statements - Australia The Good & Services Tax 3.1: Taxable Supplies and GST-Free supplies are two different types of supplies for GST purposes....
-
Magna Charter is a new corporation formed by Agnes Magna to provide an executive flying service for the southeastern United States. The founder thinks there will be a ready demand from businesses...
-
4. (Total: 6 points) Consider a non-negative continuous random variable X with an unknown distribution. (a) (3 points) Derive the Markov's inequality regarding X, that is, for any positive constant...
-
Consider a 10-year bond with a face value of $1,000 that has a coupon rate of 5.7%, with semiannual payments. a. What is the coupon payment for this bond? b. Draw the cash flows for the bond on a...
-
9. A ping pong ball is smashed straight down the centre line of the table at 60.0 km/h. However, the game is outdoors and a crosswind of 25.0 km/h sweeps across the table parallel to the net. How...
-
Suppose the economy is populated by many identical agents. They live for two periods: t and t + 1. They act as price takers and receive exogenous amounts of current and future income, Yt and Yt+1....
-
Purpose : The purpose of this exercise is to allow students to take a "hands on" approach to research Training and Development in corporate Canada, and to foster teamwork among students. ...
-
Lan Learning Tfinal= The specific heat of a certain type of metal is 0.128 J/(g- C). What is the final temperature if 305 J of heat is added to 83.0 g of this metal, initially at 20.0C? C
-
If the world price of a good exceeds the domestic price of the good, will the country export or import the good. In this scenario who gain from free trade: Domestic consumers or Domestic producers?...
-
Name some of the various types of financial intermediaries described in the chapter and indicate the primary reason(s) each was created.
-
Describe the characteristics of predictive analytics. What is the impact of Big Data in predictive analytics?
-
How is the processing of SQL DDL statements (such as CREATE TABLE) different from the processing required by DML statements?
-
Define and explain the concepts of method overriding and polymorphism. Use examples in your explanations.
-
A cost sheet and partial finished goods ledger card for Leather Originals, a manufacturer of leather furniture, are provided in the Working Papers. 1. Complete the cost sheet for Job No. 657 by...
-
Williams-Sonoma, Inc., is a specialty retailer of products for the home. The retail segment of the companys business sells products through its retail concepts: Williams-Sonoma, Pottery Barn, Pottery...
-
An analysis sheet for Gutmans Gutters, a firm that manufactures aluminum and steel gutters, is included in the Working Papers. Your instructor will guide you through the following examples. 1. For...
Study smarter with the SolutionInn App