1.32. SQLite alias

发布时间 : 2025-10-25 13:32:45 UTC      

Page Views: 9 views

You can temporarily rename the table or column to another name, which is called 别名 . The use of a table alias refers to the use of a specific SQLite Rename the table in the statement. Renaming is a temporary change, and the name of the actual table in the database does not change.

Column aliases are used for a particular SQLite Statement to rename a column in a table.

1.32.1. Grammar

The basic syntax of an alias is as follows:

SELECT column1, column2.... FROM table_name AS alias_name WHERE [condition]; 

The basic syntax of an alias is as follows:

SELECT column_name AS alias_name FROM table_name WHERE [condition]; 

1.32.2. Example

Suppose you have the following two tables. (1) the COMPANY table is as follows:

sqlite> select * from COMPANY; ID NAME AGE ADDRESS SALARY ---------- -------------------- ---------- ---------- ---------- 1 Paul 32 California 20000.0 2 Allen 25 Texas 15000.0 3 Teddy 23 Norway 20000.0 4 Mark 25 Rich-Mond 65000.0 5 David 27 Texas 85000.0 6 Kim 22 South-Hall 45000.0 7 James 24 Houston 10000.0 

(2)另一个表是 DEPARTMENT ,如下所示:

ID DEPT EMP_ID ---------- -------------------- ---------- 1 IT Billing 1 2 Engineering 2 3 Finance 7 4 Engineering 3 5 Finance 4 6 Engineering 5 7 Finance 6 

Now, here is 表别名 Here we use C and D as COMPANY And DEPARTMENT Alias for the table:

sqlite> SELECT C.ID, C.NAME, C.AGE, D.DEPT FROM COMPANY AS C, DEPARTMENT AS D WHERE C.ID = D.EMP_ID; 

Above. SQLite Statement will produce the following result:

ID NAME AGE DEPT ---------- ---------- ---------- ---------- 1 Paul 32 IT Billing 2 Allen 25 Engineerin 3 Teddy 23 Engineerin 4 Mark 25 Finance 5 David 27 Engineerin 6 Kim 22 Finance 7 James 24 Finance 

Let’s see one. 列别名 Here is an example of COMPANY_ID Yes ID The alias of the column, COMPANY_ name ``is ``name Alias for the column:

sqlite> SELECT C.ID AS COMPANY_ID, C.NAME AS COMPANY_NAME, C.AGE, D.DEPT FROM COMPANY AS C, DEPARTMENT AS D WHERE C.ID = D.EMP_ID; 

Above. SQLite Statement will produce the following result:

COMPANY_ID COMPANY_NAME AGE DEPT ---------- ------------ ---------- ---------- 1 Paul 32 IT Billing 2 Allen 25 Engineerin 3 Teddy 23 Engineerin 4 Mark 25 Finance 5 David 27 Engineerin 6 Kim 22 Finance 7 James 24 Finance 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。