# FROM clause

The FROM clause is a mandatory clause in a selectExpression.

It specifies the tables (tableExpression) from which the other clauses of the query can access columns for use in expressions. See selectExpression for more information.

## Syntax

    FROM tableExpression [ , tableExpression ]*

## Examples

    SELECT Cities.city_id
    FROM Cities
    WHERE city_id < 5
    -- other types of tableExpressions
    SELECT TABLENAME, ISINDEX
    FROM SYS.SYSTABLES T, SYS.SYSCONGLOMERATES C
    WHERE T.TABLEID = C.TABLEID
    ORDER BY TABLENAME, ISINDEX
    -- force the join order
    SELECT *
    FROM Flights, FlightAvailability
    WHERE FlightAvailability.flight_id = Flights.flight_id
    AND FlightAvailability.segment_number = Flights.segment_number
    AND Flights.flight_id < 'AA1115'
    -- a tableExpression can be a join operation. Therefore
    -- you can have multiple join operations in a FROM clause
    SELECT COUNTRIES.COUNTRY, CITIES.CITY_NAME, FLIGHTS.DEST_AIRPORT
    FROM COUNTRIES LEFT OUTER JOIN CITIES
    ON COUNTRIES.COUNTRY_ISO_CODE = CITIES.COUNTRY_ISO_CODE
    LEFT OUTER JOIN FLIGHTS
    ON Cities.AIRPORT = FLIGHTS.DEST_AIRPORT

Parent topic: SQL clauses