FROM

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.

Syntax

TableExpression

Specifies a table, view, or function; it is the source from which a TableExpression selects a result.

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 joinOperation. 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;

See Also