In SQL, what is the letter after a table name in a select statement?

后端 未结 9 1068
时光取名叫无心
时光取名叫无心 2020-12-19 11:28

In

SELECT a.NAME, a.NUMBER, a.STRING, a.RDB$DB_KEY FROM ADMIN a

what does a stand for?

Thanks.

9条回答
  •  借酒劲吻你
    2020-12-19 11:30

    a is what is called a table alias. In the part of the query that says:

    FROM ADMIN a
    

    By placing "a" after the table name, you have created an alias that can now be used in place of the table name. Without the alias, you would need to use the table's full name in order to fully-qualify the column name(s) that you are referring to in the query.

    Without the table alias, your query would look like this:

    SELECT ADMIN.NAME, ADMIN.NUMBER, ADMIN.STRING, ADMIN.RDB$DB_KEY FROM ADMIN
    

    Although since you are only selecting columns from a single table, the table name (or alias) actually isn't needed at all in this example.

提交回复
热议问题