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

后端 未结 9 1108
时光取名叫无心
时光取名叫无心 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 11:54

    An alias for the table ADMIN. It's not necessary here, because you only have one table in your query.

    When you have more than one table, and some of the columns are the same, then you need to distinguish between them. One way is to write the table name in front of the column name. E.g.,

    Select ADMIN.Name, person.name from ADMIN, person where person.id = admin.id
    

    To make this shorter, add aliases for the table names.

    select a.Name, p.Name from ADMIN a, person p where person.id = admin.id
    

提交回复
热议问题