最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
In the PostgreSQL database, if we want to get data that contains certain characters, we can use the LIKE Clause.
In LIKE Clauses are usually used in conjunction with wildcards, which represent any character. In PostgreSQL, there are two main types of wildcards:
Percent sign%
Underline _
If you do not use the above two wildcards The following is the use of the You can do it in the You can use it. XXXX It can be any number or character. The following is a demonstration of% and in the LIKE statement _ Some of the differences: Example Description WHERE SALARY::text LIKE ‘200%’ Find the data that starts with 200 in the SALARY field. WHERE SALARY::text LIKE’% 200%’ Find the data that contains 200 characters in the SALARY field. WHERE SALARY::text LIKE’_ 00%’ Find the data that has 00 in the second and third positions in the SALARY field. WHERE SALARY::text LIKE’2%’ Find the data in the SALARY field that starts with 2 and is longer than 3. WHERE SALARY::text LIKE’% 2’ Find the data that ends in 2 in the SALARY field WHERE SALARY::text LIKE’_ 2% 3’ Find the data in the SALARY field where 2 is in the second position and ends with 3 WHERE SALARY::text LIKE’2 million dollars 3’ Find the data in the SALARY field that begins with 2, ends with 3 and is 5 digits. In PostgreSQL Create the COMPANY table ( 下载 COMPANY SQL 文件 ), the data are as follows: The following example will find the data whose AGE starts with 2: The following results are obtained: The following example will find out The results are as follows: LIKE The result is the same for the clause and the equal sign. 5.21.1. Grammar ¶
LIKE Clause collocation percent sign % And underline _ General syntax for getting data from a database:SELECT FROM table_name WHERE column LIKE 'XXXX%'; 或者 SELECT FROM table_name WHERE column LIKE '%XXXX%'; 或者 SELECT FROM table_name WHERE column LIKE 'XXXX_'; 或者 SELECT FROM table_name WHERE column LIKE '_XXXX'; 或者 SELECT FROM table_name WHERE column LIKE '_XXXX_';
WHERE Any condition is specified in the. AND Or OR Specify one or more conditions. 5.21.2. Example ¶
LIKE Clauses can only be used to compare characters, so in the above example, we want to convert an integer data type to a string data type.runoobdb# select * from COMPANY; id | name | age | address | salary ----+-------+-----+-----------+-------- 1 | Paul | 32 | California| 20000 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall| 45000 7 | James | 24 | Houston | 10000 (7 rows)
runoobdb=# SELECT * FROM COMPANY WHERE AGE::text LIKE '2%';
id | name | age | address | salary ----+-------+-----+-------------+-------- 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall | 45000 7 | James | 24 | Houston | 10000 8 | Paul | 24 | Houston | 20000 (7 rows)
address The field contains - Data for characters:runoobdb=# SELECT * FROM COMPANY WHERE ADDRESS LIKE '%-%';
id | name | age | address | salary ----+------+-----+-------------------------------------------+-------- 4 | Mark | 25 | Rich-Mond | 65000 6 | Kim | 22 | South-Hall | 45000 (2 rows)