Курсовая работа: Автоматизированная система бронирования авиабилетов
DateArrival,
dbo.timeFlight(DateArrival,DateDeparture) AS TimeFlight,
CityDepartureID,
CityArrivalID,
DepartureCities.CityName AS CityDeparture,
ArrivalCities.CityName AS CityArrival,
CompanyName,
AircraftModel,
Price1,
Price2,
dbo.CountEmptyPlaces1cl(FlightID) AS EmptyPlace1cl,
dbo.CountEmptyPlaces2cl(FlightID) AS EmptyPlace2cl
FROM dbo.Flights INNER JOIN dbo.Companies
ON Group0703b.dbo.Flights.CompanyID = Group0703b.dbo.Companies.CompanyID
INNER JOIN Group0703b.dbo.Aircrafts
ON Group0703b.dbo.Flights.AircraftID = Group0703b.dbo.Aircrafts.AircraftID
LEFT OUTER JOIN Group0703b.dbo.Cities AS DepartureCities
ON Group0703b.dbo.Flights.CityDepartureID = DepartureCities.CityID
LEFT OUTER JOIN Group0703b.dbo.Cities AS ArrivalCities
ON Group0703b.dbo.Flights.CityArrivalID = ArrivalCities.CityID '
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flights_Aircrafts]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flights]'))
ALTER TABLE [dbo].[Flights] WITH CHECK ADD CONSTRAINT [FK_Flights_Aircrafts] FOREIGN KEY([AircraftID])
REFERENCES [dbo].[Aircrafts] ([AircraftID])
GO
ALTER TABLE [dbo].[Flights] CHECK CONSTRAINT [FK_Flights_Aircrafts]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flights_Cities_Arrival]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flights]'))
ALTER TABLE [dbo].[Flights] WITH CHECK ADD CONSTRAINT [FK_Flights_Cities_Arrival] FOREIGN KEY([CityArrivalID])