Which syntax assigns an alias to a table in the FROM clause?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which syntax assigns an alias to a table in the FROM clause?

Explanation:
Aliasing a table in the FROM clause means giving the table a temporary name to use elsewhere in the query. The explicit, standard way to do this is writing FROM customers AS c. Here, the real table is customers, and c becomes its alias, so you can reference columns as c.column in the rest of the query, for example: SELECT c.id FROM customers AS c. The AS form is clear and portable across databases. Some dialects also allow omitting AS, as in FROM customers c, which is equivalent in many systems. The syntax that places the alias in the SELECT clause isn’t how you assign a table alias in the FROM clause. And a form like FROM AS c is invalid because it lacks a table name.

Aliasing a table in the FROM clause means giving the table a temporary name to use elsewhere in the query. The explicit, standard way to do this is writing FROM customers AS c. Here, the real table is customers, and c becomes its alias, so you can reference columns as c.column in the rest of the query, for example: SELECT c.id FROM customers AS c. The AS form is clear and portable across databases. Some dialects also allow omitting AS, as in FROM customers c, which is equivalent in many systems. The syntax that places the alias in the SELECT clause isn’t how you assign a table alias in the FROM clause. And a form like FROM AS c is invalid because it lacks a table name.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy