Access comparison and logical operators.

Reprinted from the product is slightly Library  http://www.pinlue.com/article/2020/04/0809/2710135903542.html

 

This section describes the comparison operators, and logical operators. In the third step of setting the conditions of the query design more commonly used.

Comparison operators, and logical operators is relatively simple, to the basics, then learn by example.

First, comparison operators

Comparator, for comparing the magnitude relation of the two values ​​or expressions, comparison operators and called relationship. A logic operation result value (True and False) or NULL. Access database support comparison operators are as follows:

II. Logical Operators

Logical operators can operate on logical value, that the result of the arithmetic or logical value Null (empty) expression composed of a logical operator is logical expressions.

When the logical expression is often used a custom query, commonly used in Access There are three logical operators:

And: logic, logical representation of two values ​​with the operation, only when the two logical values ​​are True, only the result is True, otherwise False.

Or: logical or, logical values ​​indicate that two or operation, only when the two logical values ​​are False, the result was to False, otherwise True.

Not: logical negation, logical representation value is inverted, as a result Not True is False, the result Not False to True.

Logical operator and a function of Excel VBA programming content is based, does not expand in detail. To demonstrate by example.

Third, examples

1, an example of a

Price inquiry than or equal to 55 yuan name and ISBN of the book. (In the third step is to determine the condition of the query design set.)

Create a query design, add a book table, double-click Add field: ISBN, name and unit price fields. Disposed at the side condition price fields> = 55. Save the query can run.

2, two exemplary

Price inquiry less than or equal to 50 and 55 of the book's name and press.

Create a query design, add a table of books and publishers tables, table relationships have been established to ensure, double-click Add Fields: Book a table name and unit price, as well as the name of the publisher table. Condition setting conditions below monovalent> = 50 and <= 55. Save the query can run.

3, Example Three

When the above two examples of actual setting conditions, attention "condition" there is a line following the line relationship "OR". Actually the same actions and logical operators Or.

Suppose there are problems to query monovalent less than or equal to 50 and 55, or a monovalent equivalent of the title of the book 60.

Create a query design, add books table, double-click Add fields: name and unit price, the unit price under the conditions set in the condition of> = 50 and <= 55, or add rows = 60, run the query can be saved.

Can be seen by the results of the query conditions,> = 50 and <= 55 and 60 = is or relationship. I.e., one of two conditions are met can.

 

Published 60 original articles · won praise 58 · Views 140,000 +

Guess you like

Origin blog.csdn.net/yihuliunian/article/details/105393546