- Access数据库程序设计
- 刘雨潇 项东升
- 398字
- 2025-02-20 06:32:43
3.2.4 查询条件示例
1.使用数字型数据作为查询条件
在创建查询时可以使用数值加上运算符组成查询条件。常见示例如表3.5所示。
表3.5 数值作为查询条件示例

2.使用文本型数据作为查询条件
在创建查询时使用文本值作为查询条件可以限定查询的文本值范围。常见示例如表3.6所示。注意,查询条件中的文本型常量要加上定界符双引号("")或单引号('')。
表3.6 文本值作为查询条件示例

续表

3.使用日期型数据作为查询条件
使用日期型数据作为查询条件可以限定查询时日期的范围。常见示例如表3.7所示。注意,查询条件中的文本型常量要加上定界符“#”。
表3.7 日期值作为查询条件示例

4.使用空值作为查询条件
空值使用Null或空白表示字段的值。空字符串是用双引号括起来的字符串,且双引号中间没有任何字符。使用空值作为查询条件的示例如表3.8所示。
表3.8 空值或空字符串作为查询条件示例

注意,在查询条件中出现的字段名称必须用方括号括起来,而且数据类型应与对应字段定义的数据类型相符合。