rwallace
rwallace

Reputation: 33375

Sqlite SELECT syntax

A common form of SQL SELECT names fetched records as in

SELECT * from employee e1 ...

where the e1 is added as the name of the record, to be further referred to in the body of the query.

Where exactly in the syntax definition for SELECT is a record name provided for? Sqlite does indeed support this syntax, but I've been looking at the syntax diagram and I can't see any mention of such an option:

https://sqlite.org/lang_select.html

Upvotes: 0

Views: 62

Answers (2)

Damien
Damien

Reputation: 1600

SELECT * from employee as e1;

e1 is a table alias.

But if you write your syntax like this

SELECT e1 from employee;

You are selecting the data in column e1 from the table employee.

Upvotes: 0

Simulant
Simulant

Reputation: 20112

Look at the schema for table-or-subquery after the table name you can add an optional table-alias with an optional AS to clarify the use of an alias. e1 in your example is a table-alias.

Upvotes: 1

Related Questions