《Database System Concepts》的笔记-3.3.1 Queries on a Single Relation
- 章节名：3.3.1 Queries on a Single Relation
- 2015-01-25 13:53:56
In the formal, mathematical definition of the relational model, a relation is a set. Thus, duplicate tuples would never appear in relations. In practice, duplicate elimination is time-consuming. Therefore, SQL allows duplicates in relations as well as in the results of SQL expressions.In those cases where we want to force the elimination of duplicates, we insert the keyword distinct after select.SQL allows us to use the keyword all to specify explicitly that duplicates are not removed.Since duplicate retention is the default, we shall not use all in our examples.The select clause may also contain arithmetic expressions involving the op- erators +, −, ∗, and / operating on constants or attributes of tuples.The where clause allows us to select only those rows in the result relation of the from clause that satisfy a specified predicate.SQL allows the use of the logical connectives and, or, and not in the where clause. The operands of the logical connectives can be expressions involving the comparison operators <, <=, >, >=, =, and <>. SQL allows us to use the comparison operators to compare strings and arithmetic expressions, as well as special types, such as date types.
geeklok对本书的所有笔记 · · · · · ·
说明 · · · · · ·