Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:41:16+00:00 2026-06-15T17:41:16+00:00

I have this schema: CREATE TABLE Airport ( airportIATA CHAR(3) NOT NULL, name VARCHAR(45)

  • 0

I have this schema:

CREATE TABLE Airport (
  airportIATA CHAR(3) NOT NULL,
  name VARCHAR(45) NOT NULL, 
  PRIMARY KEY (airportIATA) 
  );

CREATE TABLE Flight (
  flightNumber VARCHAR(6) NOT NULL,
  timeOfDeparture TIME NOT NULL,
  departureAirport_IATA CHAR(3) NOT NULL REFERENCES Airport(airportIATA),
  stopOverAirport_IATA CHAR(3) REFERENCES Airport(airportIATA),
  arrivalAirport_IATA CHAR(3) NOT NULL REFERENCES Airport(airportIATA),
  PRIMARY KEY (flightNumber, departureAirport_IATA, arrivalAirport_IATA)
  );

with these records:

INSERT INTO Airport VALUES ('HEL','Helsinki/Vantaa Airport');
INSERT INTO Airport VALUES ('STO','Stockholm Airport');
INSERT INTO Airport VALUES ('TAL', 'Lennart Meri Tallinn Airport');

INSERT INTO Flight VALUES ('AY101', '13:30', 'HEL', NULL, 'STO');
INSERT INTO Flight VALUES ('AA202', '16:15', 'STO', 'TAL', 'HEL');

So far, I have these queries:

SELECT flightNumber, timeOfDeparture, departureAirport_IATA, arrivalAirport_IATA
FROM Flight
WHERE stopOverAirport_IATA IS NULL;



SELECT flightNumber, timeOfDeparture, name AS 'Arrival Airport'
FROM Flight, Airport
WHERE Flight.stopOverAirport_IATA IS NULL AND Flight.arrivalAirport_IATA = Airport.airportIATA;

My question is, how do I change the latter query so it includes the names of both the arrival & departure airports (as we get for IATA codes in the first query)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:41:16+00:00Added an answer on June 15, 2026 at 5:41 pm

    Try something like this:

    SELECT
      flightNumber, 
      timeOfDeparture, 
      DA.name AS 'Departure Airport',
      AA.name AS 'Arrival Airport'
    FROM
      Flight As F
      INNER JOIN Airport As DA
      ON F.departureAirport_IATA = DA.airportIATA
      INNER JOIN Airport As AA
      ON F.arrivalAirport_IATA = AA.airportIATA
    WHERE 
      F.stopOverAirport_IATA IS NULL
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With this schema: create table object ( obj_id serial primary key, name varchar(80) not
This is my schema: CREATE TABLE item ( id integer NOT NULL PRIMARY KEY
I have this schema: CREATE TABLE `lotto`.`combinaciones` ( `indice` mediumint(8) unsigned NOT NULL, `binario`
I currently have this schema: CREATE TABLE `users` ( `users_id` int(11) NOT NULL AUTO_INCREMENT,
I have this code: $createFields=CREATE TABLE temp_field (fld text NOT NULL, tablename char(50) NOT
Given the following schema: CREATE TABLE players ( id BIGINT PRIMARY KEY, name TEXT
I have the following table schema: create table SerialNo2( IncarnationID_UID counter primary key, Mark
I have an orders table with a schema like this. CREATE TABLE orders (
I have a schema that essentially looks like this: CREATE TABLE `data` ( `id`
I have an sqlite database on android created like this: sqlite> .schema CREATE TABLE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.