|

楼主 |
发表于 2007-7-18 17:58:20
|
显示全部楼层
谢谢楼上的,这里我只想知道~'[^S]'的具体意思,不是针对这条检索语句,因为看看书上是这么说的:
Some might think that it returns rows that do not contain an S. Actually, it returns all rows that have any character that is not an S. For example, Sandy contains characters that are not S, such as a, n, d, and y, so that row is returned.
The test would prevent rows containing only S's from being printed.
我理解这段话的意思是,这条语句不打印firstname中包含S的column
但从我测试后发现它把什么record都打印出来了,不管有没有S在firstname字段了
这是书上例子
test=> -- firstname contains a non-S character
test=> SELECT * FROM friend
test-> WHERE firstname ~ '[^S]'
test-> ORDER BY firstname;
firstname | lastname | city | state | age
-----------------+----------------------+-----------------+-------+-----
Dean | Yeager | Plymouth | MA | 24
Dick | Gleason | Ocean City | NJ | 19
Ned | Millstone | Cedar Creek | MD | 27
Sandy | Gleason | Ocean City | NJ | 25
Sandy | Weber | Boston | MA | 33
Victor | Tabor | Williamsport | PA | 22 |
|