Warning message

Documentation is currently being migrated into the new system. Some pages might be temporarily missing, and some guides might appear empty. Thank you for your patience while we are improving Drupal.org documentation.

Oracleism: Don't use AS for table aliases

Last updated on
September 8, 2016 - 14:46

In both MySQL and PostgreSQL, when giving tables aliases in the FROM clause, it is optional to use the AS keyword.

SELECT n.nid, u.uid, u.name FROM {node} AS n LEFT JOIN {user} AS u ON n.uid = u.uid;

However, the Oracle database does not allow AS to be use in FROM or any JOINs.

SELECT n.nid, u.uid, u.name FROM {node} n LEFT JOIN {user} u ON n.uid = u.uid;

Unfortunately, this makes finding the right alias for a table rather difficult.