简体   繁体   中英

Oracle sqlplus 12c error with queries

Airport(Airport, AName, CheckIN, Resvtns, FlightInfo)
Route(RouteNo, RDescription)
Fares(FareType, Fdescription, Conditions)
Tariff(RouteNo , FareType, Price)
Aircraft(AircraftType, ADescription, NoSeats)
Flight(FlightNo, FromAirport, ToAirport, DepTime, ArrTime, Service, AircraftType, RouteNo)
Passenger(Pid, Name, Address, TelNo)
Ticket(TicketNo, TicketDate, PID)
Itinerary(TicketNo, FlightNo, LegNo, FlightDate, FareType)

Hi, can someone help me fix this query? The error is written below.

List the names of the passengers with at least two tickets which cost over £180 each.

SELECT Name 
FROM Passenger 
WHERE Pid IN (SELECT p FROM (SELECT Pid AS p,count(*) AS c FROM Ticket
GROUP BY PID HAVING count(*) >1) AS tic);

error: Missing right parenthesis Line 4

Your query should simply be

SELECT name
FROM   passenger
WHERE  pid IN (SELECT pid
               FROM  Ticket
               GROUP  BY pid
               HAVING Count(*) > 1);  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM