个人数据库与文件数据库在SQL WHERE子句写法的区别
-----------------------------------摘抄于ArcGIS10帮助 查询文件地理数据库所使用的 SQL WHERE 子句语法与查询 coverage、shapefile 及其他基于文件的数据源的语法相同,但增加了一些功能,例如支持子查询。因此,WHERE 子句语法是有别于个人地数据库的。A
-----------------------------------摘抄于ArcGIS10帮助
查询文件地理数据库所使用的 SQL WHERE 子句语法与查询 coverage、shapefile 及其他基于文件的数据源的语法相同,但增加了一些功能,例如支持子查询。因此,WHERE 子句语法是有别于个人地数据库的。ArcGIS 中用于创建 SQL 表达式的对话框可帮助您对要查询的数据使用正确的 WHERE 子句语法,因为它们利用适当的分隔符列出字段名称和值。而且还为您选择相关的关键字和运算符。然而,如果为个人地理数据库中的某个图层定义了一条 WHERE 子句,则一旦将此图层的源数据移动到文件地理数据库之后,这条子句可能不会对同一图层起作用。以下是 WHERE 子句不起作用的可能原因:
- 对于个人地理数据库,字段名称括在方括号中,但对于文件地理数据库,它们括在双引号中。
- 在个人地理数据库中,通配符 * 代表任意数量的字符,通配符 ? 代表一个字符。而文件地理数据库则分别使用 % 和 _。
- 个人地理数据库中的字符串搜索不区分大小写,但在文件地理数据库中则区分大小写。
- 个人地理数据库使用 UCASE 和 LCASE 转换字符串大小写,但文件地理数据库使用 UPPER 和 LOWER。
- 个人地理数据库中用 # 分隔日期和时间,但在文件地理数据库中它们则以单词 date 开头。
用于个人地理数据库的 WHERE 子句语法 |
用于文件地理数据库的等效语法 |
---|---|
[STATE_NAME] = 'California' |
"STATE_NAME" = 'California' |
[OWNER_NAME] LIKE '?atherine smith' |
"OWNER_NAME" LIKE '_atherine smith' |
[STATE_NAME] = 'california'(需要进行不区分大小写的搜索时) |
LOWER("STATE_NAME") = 'california' |
UCASE([LAST_NAME]) = 'JONES' |
UPPER("LAST_NAME") = 'JONES' |
[DATE_OF_BIRTH] = #06-13-2001 19:30:00# |
"DATE_OF_BIRTH" = date '2001-06-13 19:30:00' |
WHERE 子句不起作用的另一个原因是,文件地理数据库支持的运算符和函数比个人地理数据库支持的要少,而且文件地理数据库只对子查询提供有限的支持。然而,这不太可能是 WHERE 子句不起作用的原因。文件地理数据库支持大多数可能需要使用的 WHERE 子句功能。
----------------------------ArcObject开发-------------------------
如果您用 ArcObjects 编写了一个应用程序,并想要将该应用程序访问的数据从个人地理数据库切换到文件地理数据库,可考虑以下操作:
- 更新工作空间工厂,使该应用程序对新数据源进行操作。将工作空间工厂从 AccessWorkspaceFactory 更改为 FileGDBWorkspaceFactory,并将地理数据库扩展名从 .mdb 更改为 .gdb。
-
如果您的应用程序使用 SQL,则可能需要更新语法以使其对文件地理数据库起作用:
- 正如前文所述,文件地理数据库与个人地理数据库的 SQL WHERE 子句语法是有区别的。如果应用程序使用 QueryFilter 或 QueryDef,请参考前面对 WHERE 子句的讨论,以了解可能需要进行哪些更改。
- 文件地理数据库并不支持可对个人地理数据库使用的所有功能和函数。ArcGIS 9.2 中,文件地理数据库不支持的最常用的函数包括 DISTINCT、GROUP BY 和 ORDER BY,在子查询外不支持集合函数 AVG、COUNT、MIN、MAX 和 SUM。在将来的版本中有可能添加对其中某些函数的支持。
- 文件地理数据库只提供有限的 QueryDef 连接支持,子字段只能包含简单的列名称;不支持别名、表达式和函数。FROM 子句只能包含简单的表名。
-
文件地理数据库中对 INSERT 和 UPDATE 的 ExecuteSQL 支持被限制为只包含文本值的简单语句。在 INSERT 和 UPDATE 语句中,不支持复合表达式(如
<span>SET RENTAL_PRICE = (RENTAL_PRICE - 1.00)</span>
)以及子查询。但 DELETE 语句不受限制;它支持文件地理数据库所支持的任何 WHERE 子句功能。 - 如果应用程序包含子查询,这些子查询可能对文件地理数据库不起作用,因为对它们的支持是受限制的。有关详细信息,请参阅 SQL 参考。
- 要最大化数据传输性能,请在要加载大量记录时,考虑使用只加载模式。有关详细信息,请参阅下面的“性能提示”。
除这些差异之外,ArcObjects 在文件地理数据库上的工作方式与在个人地理数据库上是相同的。

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

SQL commands in MySQL can be divided into categories such as DDL, DML, DQL, DCL, etc., and are used to create, modify, delete databases and tables, insert, update, delete data, and perform complex query operations. 1. Basic usage includes CREATETABLE creation table, INSERTINTO insert data, and SELECT query data. 2. Advanced usage involves JOIN for table joins, subqueries and GROUPBY for data aggregation. 3. Common errors such as syntax errors, data type mismatch and permission problems can be debugged through syntax checking, data type conversion and permission management. 4. Performance optimization suggestions include using indexes, avoiding full table scanning, optimizing JOIN operations and using transactions to ensure data consistency.

InnoDB achieves atomicity through undolog, consistency and isolation through locking mechanism and MVCC, and persistence through redolog. 1) Atomicity: Use undolog to record the original data to ensure that the transaction can be rolled back. 2) Consistency: Ensure the data consistency through row-level locking and MVCC. 3) Isolation: Supports multiple isolation levels, and REPEATABLEREAD is used by default. 4) Persistence: Use redolog to record modifications to ensure that data is saved for a long time.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

InnoDB effectively prevents phantom reading through Next-KeyLocking mechanism. 1) Next-KeyLocking combines row lock and gap lock to lock records and their gaps to prevent new records from being inserted. 2) In practical applications, by optimizing query and adjusting isolation levels, lock competition can be reduced and concurrency performance can be improved.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools