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
-
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...
-
Why are normal forms alone insufficient as a condition for a good schema design?
-
In Exercises match the graph of in the left column with that of its derivative in the right column. (a) (b) (c) (d) Graph of f' y 3 VALA 2 -2 -3+ X
-
The accounting records of Compass Bookstores, Inc., include the following: Requirement Report these liabilities on Compass Bookstores' balance sheet, including headings and totals for current...
-
If the U.S. dollar was expected to strengthen relative to a foreign currency (FC), what effect might this have on a U.S. exporter?
-
On June 30, Ayayai Corp. discontinued its operations in Mexico. During the year, the operating income was $150,000 before taxes. On September 1, Ayayai disposed of the Mexico facility at a pretax...
-
1. The clear majority of compute nodes in modern enterprise environments are networked. Can you think of any circumstances where a compute node would NOT be networked? Describe. 2. Many commercial...
-
Analyze this outcrop, photographed by geologist, Thomas McGuire. It is another natural geologic cross section with red sandstone layers on the bottom and a yellow conglomerate (graved) rock layer on...
-
The "Emerging Constitutional Question" (ECQ) is an opportunity for you to explore emerging constitutional issues in our country. This is also an opportunity to develop the ability to understand legal...
-
Using these terms "encumbrances, easements and licenses," all which affect the owner's rights to 1) Possession, 2) Use and 3) Power of Disposition of their land . These restrictions can be recognized...
-
Nash's Trading Post, LLC compiled the following financial information as of December 31, 2022: Service revenue $825000 Common stock 175000 Equipment 225000 Operating expenses 725000 Cash 200000...
-
Assume a constant annual interest rate of 5%. A bank has an asset base that delivers cash flows for the next 5 years as shown in the table below. It wishes to structure its liabilities so as to match...
-
John is offering a house for sale for $200,000 with an assumable loan which was made 5 years ago for $160,000 at 8.75 percent over 30 years. Mary is interested in buying the property.A bank can grant...
-
Here is a Python program. count = 0 number 0 myfile = open("text.txt", "r") for line in myfile: line line.rstrip() line line.split() if not count: number = len(line) count count + 1 if len(line) >...
-
C- Consider the following scenario:- A supermarket needs to develop the following software to encourage regular customers. For this, the customer needs to supply his/her residence address, telephone...
-
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.
-
Prove that \(C_{P}-C_{V}=\frac{T V \beta^{2}}{\alpha}\) where \[ \alpha=\text { Isothermal compressibility } \] \[ \begin{equation*} \beta=\text { Volume expansivity } \tag{WBUT,2007} \end{equation*}...
-
Prove that \[ d H=C_{P} d T+\left[V-T\left(\frac{\partial V}{\partial T} ight)_{P} ight] d P \]
-
Show that \(\left(\frac{\partial U}{\partial P} ight)_{T}=(\alpha P-\beta T) V\).
Study smarter with the SolutionInn App