0
CREATE TABLE LeadCustomer 
( 
  CustomerID INTEGER NOT NULL, FirstName VARCHAR(20) NOT NULL, 
  Surname VARCHAR(40) NOT NULL, BillingAddress VARCHAR(200) NOT NULL, 
  email VARCHAR(30) NOT NULL    
)

CREATE TABLE Flight 
(
 FlightID INTEGER NOT NULL, FlightDate TIMESTAMP NOT NULL, 
 Origin VARCHAR(30) NOT NULL, Destination VARCHAR(30) NOT NULL, 
 MaxCapacity INTEGER NOT NULL, PricePerSeat DECIMAL NOT NULL
)

CREATE TABLE FlightBooking 
(
 BookingID INTEGER NOT NULL, CustomerID INTEGER NOT NULL, FlightID INTEGER NOT NULL,
 NumSeats INTEGER NOT NULL, Status CHAR(1) NOT NULL, BookingTime TIMESTAMP NOT NULL, 
 TotalCost DECIMAL 
)

如果航班改期,我们如何生成需要联系的客户列表?

到目前为止,我已经完成了:

SELECT
LeadCustomer.CustomerID,Flight.FlightID 
FROM LeadCustomer 
inner join FlightBooking 
ON LeadCustomer.CustomerID = FlightBooking.CustomerID            
inner join 
Flight ON FlightBooking.FlightID = Flight.FlightID;

但不知道如何更新飞行时间

4

1 回答 1

0

我了解 Flight.FlightDate 等于 FlightBooking.BookingTime。当您更新第一列时,您可以搜索一个与另一个不同的地方,例如:

SELECT
LeadCustomer.CustomerID,Flight.FlightID 
FROM LeadCustomer 
inner join FlightBooking 
ON LeadCustomer.CustomerID = FlightBooking.CustomerID            
inner join 
Flight ON FlightBooking.FlightID = Flight.FlightID
WHERE Flight.FlightDate <> FlightBooking.BookingTime

如果我错了,你能更好地解释一下吗

于 2013-04-10T15:14:27.120 回答