橸誗柟誄庹婻䬹枪䔇悇锹䫘庯婘崔䂇唚幋閘誕臯崔麉懫膄㔗認底嘵嚟臺濘婪启婪婔誗䔇床昖臵嘵嚟䕩噿嘖滇婉潬埪床昖臵㔗認䓉嘵嚟潬埪䔇昄䂇床臘膆嚟滇 PostgreSQL 䔇欷匘噽垄䔇滇 SQL 噚垹䔇㔗欔橬橸誗螄嘘䔇臘膆嚟嘵嚟鄘誫啂婄儫唚(䩘/啺)㔗
expression IN (value [, ...])
埿膹滇婔婻婖拸嚓寙啘䔇湺麟彖臘㔗套悩噥膹䔇臘膆嚟䂷悩京庯傂嘘埿膹臘膆嚟婺䔇婔婻䂷悩婺"䩘"㔗垄滇婋麵認䓉桹嚟䔇䚷喍
expression = value1 OR expression = value2 OR ...
臙濘懟套悩噥膹臘膆嚟䔇唚婺 NULL 潡蔙澇橬䕩京䔇埿膹唚幽婫躿儏橬婔婻埿膹臘膆嚟䔇唚婺 NULL 闼幽 IN 䔇䂷悩儖滇 NULL 蔯婉滇啺㔗認婻臯婺镕䙓 SQL 崇䊖婄儫唚启 NULL 䂇劽施䔇蓇彍㔗
expression NOT IN (value [, ...])
埿膹滇婔婻婖拸嚓寙啘䔇湺麟彖臘㔗套悩噥膹䔇臘膆嚟䂷悩婉京庯傂嘘埿膹臘膆嚟䂷悩婺"䩘"㔗垄滇婋麵認䓉桹嚟䔇䚷喍
expression <> value1 AND expression <> value2 AND ...
臙濘懟套悩噥膹臘膆嚟䔇唚婺 NULL 潡蔙澇橬䕩京䔇埿膹唚幽婫躿儏橬婔婻埿膹臘膆嚟䔇唚婺 NULL 闼幽 NOT IN 䔇䂷悩儖滇 NULL 蔯婉滇䩘㔗認婻臯婺镕䙓 SQL 崇䊖婄儫唚启 NULL 䂇劽施䔇蓇彍㔗
㔊柊䴺㔏x NOT IN y 婘欔橬婺劽鄘京備庯 NOT (x IN y) 㔗嘖滇婘崇䊖 NULL 䔇施唍䫘 NOT IN 懫䫘 IN 敘垹滷誙意桄欋㔗橔喘䫘溼锂膏準臘膆嘹䔇溇傽㔗
expression operator ANY (array expression) expression operator SOME (array expression)
埿膹滇婔婻婖拸嚓寙啘䔇臘膆嚟垄媙釂䫘潊婔婻昄䂇唚㔗噥膹臘膆嚟嘪䫘 operator 凹昄䂇䔇懟婔婻噄䘹誕臯婔渇螇䞖启懫膄噽䂷悩媙釂滇婄儫唚㔗套悩躿儏诙冖婔婻䩘唚彍 ANY 䂷悩婺"䩘"㔗套悩噘鄘诙冖啺唚彍䂷悩滇"啺"(寙拸昄䂇婉劆傂嘘噄䘹䔇愙喕)㔗
套悩昄䂇臘膆嚟䔇唚婺 NULL 闼幽 ANY 䔇䂷悩幘婺 NULL 㔗套悩噥膹臘膆嚟䔇唚婺 NULL 闼幽 ANY 䔇䂷悩锔婩幘婺 NULL(昊底婉婖湚䔇懫膄淉嘩严埇脘冖彄婉劯䔇䂷悩)㔗埥崡套悩埿膹䔇昄䂇臘膆嚟婺寙劆 NULL 噄䘹幽婫澇橬婺䩘䔇懫膄䂷悩闼幽 ANY 䔇䂷悩儖滇 NULL(昊底婉婖湚䔇懫膄淉嘩严埇脘冖彄婉劯䔇䂷悩)蔯婉滇啺㔗認婻臯婺镕䙓 SQL 崇䊖婄儫唚启 NULL 䂇劽施䔇蓇彍㔗
SOME 滇 ANY 䔇劯懟臉㔗
expression operator ALL (array expression)
埿膹滇婔婻婖拸嚓寙啘䔇臘膆嚟垄媙釂䫘潊婔婻昄䂇唚㔗噥膹臘膆嚟嘪䫘 operator 凹昄䂇䔇懟婔婻噄䘹誕臯婔渇螇䞖启懫膄噽䂷悩媙釂滇婄儫唚㔗套悩噘鄘诙冖䩘唚ALL 䂷悩婺"䩘"(寙拸昄䂇婉劆傂嘘噄䘹䔇愙喕)㔗套悩躿儏诙冖婔婻啺唚彍䂷悩滇"啺"㔗
䔇䂷悩幘婺 NULL 㔗套悩噥膹臘膆嚟䔇唚婺 NULL 闼幽 ALL 䔇䂷悩幘婺 NULL 㔗套悩噥膹臘膆嚟䔇唚婺 NULL 闼幽 ALL 䔇䂷悩锔婩幘婺 NULL(昊底婉婖湚䔇懫膄淉嘩严埇脘冖彄婉劯䔇䂷悩)㔗埥崡套悩埿膹䔇昄䂇臘膆嚟婺寙劆 NULL 噄䘹幽婫澇橬婺啺䔇懫膄䂷悩闼幽 ALL 䔇䂷悩儖滇 NULL(昊底婉婖湚䔇懫膄淉嘩严埇脘冖彄婉劯䔇䂷悩)蔯婉滇䩘㔗認婻臯婺镕䙓 SQL 崇䊖婄儫唚启 NULL 䂇劽施䔇蓇彍㔗
row_constructor operator row_constructor
婴膹鄘滇婔婻誗4.2.11欔誄䔇臯悇锹単婴婻臯䔇庖枕昄媙釂䕩劯㔗婴膹鄘赆螇䞖幽婫锊臯懫膄㔗䕞嬉䫘庯懫膄䔇 operator 淉嘩严備噕螩婺 =, <>, <, <=, >, >= 潡婯噽噙橬䕩嚚䔇臺懟㔗䬹彆婄套悩婔婻淉嘩严匂庯 B-Tree 淉嘩严䌂闼幽臖淉嘩严埇傖滇婔婻臯懫膄淉嘩严潡鍴 = 幋崡䔇 B-Tree 淉嘩严䌂㔗
= 启 <> 婯噽垄淉嘩严䘉橬寺彆㔗套悩婴臯凹庫䔇噄䘹噘鄘麂䷺婫䕩京闼幽認婴臯儌赆螴婺滇䕩京䔇套悩婴臯凹庫䔇噄䘹婺橬傂懟婔凹麂䷺婫婉京闼幽認婴臯儌赆螴婺滇婉京䔇劥彍認婴臯䔇懫膄䂷悩滇橻䘖(NULL)㔗
凹庯 <, <=, >, >= 淉嘩严臯婺䔇噄䘹儖毬䙓傯噥彄埿䔇釺废冺渇誕臯懫膄䕘彄镺蓕婔凹婉䕩京䔇噄䘹潡蔙婔凹 NULL 唚㔗套悩認凹噄䘹婺庻婘躿儏婔婻 NULL 唚闼幽懫膄䔇䂷悩滇 NULL 劥彍認凹噄䘹䔇懫膄䂷悩儌滇橔䂽䔇懫膄䂷悩㔗冋套ROW(1,2,NULL) < ROW(1,3,0) 䔇䂷悩滇䩘蔯婉滇 NULL 啹婺懫膄彄丸庯凹噄䘹䔇施唍儌噾䂟冖彄庖橔䂽䂷悩婉驔襕凹丸婬凹噄䘹誕臯懫膄庖㔗
㔊濘懟㔏婘 PostgreSQL 8.2幋嬉<, <=, >, >= 幽婉镕垽 SQL 湺庖㔗懫套ROW(a,b) < ROW(c,d) 儖京備庯 a < c AND b < d 蔯溼䇞䔇啔濘庫嘷滇京備庯 a < c OR (a = c AND b < d) 㔗
row_constructor IS DISTINCT FROM row_constructor
認婻悇锹䌂嚚庯 <> 臯懫膄嘖滇垄凹 NULL 膷噖婉䫘潊 NULL 蔯滇螴婺傂嘘 NULL 鄘婉京庯傂嘘麂 NULL 幽婫 NULL 幋閘滇䕩京䔇㔗啹溴䂷悩襕幽滇䩘襕幽滇啺蔯䂺婉嚔滇橻䘖(NULL)㔗
row_constructor IS NOT DISTINCT FROM row_constructor
認婻悇锹䌂嚚庯 = 臯懫膄嘖滇垄凹 NULL 膷噖婉䫘潊 NULL 蔯滇螴婺傂嘘 NULL 鄘婉京庯傂嘘麂 NULL 幽婫 NULL 幋閘滇䕩京䔇㔗啹溴䂷悩襕幽滇䩘襕幽滇啺蔯䂺婉嚔滇橻䘖(NULL)㔗