هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Comparison Functions

Updated on 2024-04-19 GMT+08:00
Table 1 Comparison functions

SQL Function

Return Type

Description

value1 = value2

BOOLEAN

Returns TRUE if value1 equals value2;

returns UNKNOWN if either value1 or value2 is NULL.

value1 <> value2

BOOLEAN

Returns TRUE if value1 does not equal value2;

returns UNKNOWN if either value1 or value2 is NULL.

value1 > value2

BOOLEAN

Returns TRUE if value1 is greater than value2;

returns UNKNOWN if either value1 or value2 is NULL.

value1 >= value2

BOOLEAN

Returns TRUE if value1 is greater than or equal to value2;

returns UNKNOWN if either value1 or value2 is NULL.

value1 < value2

BOOLEAN

Returns TRUE if value1 is less than value2;

returns UNKNOWN if either value1 or value2 is NULL.

value1 <= value2

BOOLEAN

Returns TRUE if value1 is less than or equal to value2;

returns UNKNOWN if either value1 or value2 is NULL.

value IS NULL

BOOLEAN

Returns TRUE if value is NULL.

value IS NOT NULL

BOOLEAN

Returns TRUE if value is not NULL.

value1 IS DISTINCT FROM value2

BOOLEAN

Returns TRUE if value1 and value2 have different data types or values;

returns FALSE if they have the same data types and values.

Treats NULL as the same.

For example:

1 IS DISTINCT FROM NULL returns TRUE;

NULL IS DISTINCT FROM NULL returns FALSE.

value1 IS NOT DISTINCT FROM value2

BOOLEAN

Returns TRUE if they have the same data types and values;

returns FALSE if value1 and value2 have different data types or values.

Treats NULL as the same.

For example:

1 IS NOT DISTINCT FROM NULL returns FALSE;

NULL IS NOT DISTINCT FROM NULL returns TRUE.

value1 BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3

BOOLEAN

Returns TRUE if value1 is greater than or equal to value2 and less than or equal to value3, using the default or ASYMMETRIC keyword.

If SYMMETRIC is used, returns TRUE if value1 is inclusively between value2 and value3.

Returns FALSE or UNKNOWN if value2 or value3 is NULL.

For example:

  • 12 BETWEEN 15 AND 12 returns FALSE;
  • 12 BETWEEN SYMMETRIC 15 AND 12 returns TRUE;
  • 12 BETWEEN 10 AND NULL returns UNKNOWN;
  • 12 BETWEEN NULL AND 10 returns FALSE;
  • 12 BETWEEN SYMMETRIC NULL AND 12 returns UNKNOWN.

value1 NOT BETWEEN [ ASYMMETRIC | SYMMETRIC ] value2 AND value3

BOOLEAN

Returns TRUE if value1 is less than value2 or greater than value3, using the default or ASYMMETRIC keyword.

If SYMMETRIC is used, returns TRUE if value1 is not between value2 and value3.

Returns TRUE or UNKNOWN if value2 or value3 is NULL.

For example:

  • 12 NOT BETWEEN 15 AND 12 returns TRUE;
  • 12 NOT BETWEEN SYMMETRIC 15 AND 12 returns FALSE;
  • 12 NOT BETWEEN NULL AND 15 returns UNKNOWN;
  • 12 NOT BETWEEN 15 AND NULL returns TRUE;
  • 12 NOT BETWEEN SYMMETRIC 12 AND NULL returns UNKNOWN.

string1 LIKE string2 [ ESCAPE char ]

BOOLEAN

Returns TRUE if string1 matches string2;

returns UNKNOWN if either string1 or string2 is NULL.

Escape characters can be defined if needed, but they are not currently supported.

string1 NOT LIKE string2 [ ESCAPE char ]

BOOLEAN

Returns TRUE if string1 does not match string2;

returns UNKNOWN if either string1 or string2 is NULL.

Escape characters can be defined if needed, but they are not currently supported.

string1 SIMILAR TO string2 [ ESCAPE char ]

BOOLEAN

Returns TRUE if string1 matches the SQL regular expression string2;

returns UNKNOWN if either string1 or string2 is NULL.

Escape characters can be defined if needed, but they are not currently supported.

string1 NOT SIMILAR TO string2 [ ESCAPE char ]

BOOLEAN

Returns TRUE if string1 does not match the SQL regular expression string2;

returns UNKNOWN if either string1 or string2 is NULL.

Escape characters can be defined if needed, but they are not currently supported.

value1 IN (value2 [, value3]* )

BOOLEAN

Returns TRUE if value1 exists in the given list (value2, value3, …);

returns TRUE if the list contains NULL and value1 can be found, otherwise returns UNKNOWN.

Always returns UNKNOWN if value1 is NULL.

For example:

  • 4 IN (1, 2, 3) returns FALSE;
  • 1 IN (1, 2, NULL) returns TRUE;
  • 4 IN (1, 2, NULL) returns UNKNOWN.

value1 NOT IN (value2 [, value3]* )

BOOLEAN

Returns TRUE if value1 does not exist in the given list (value2, value3, …);

returns FALSE if the list contains NULL and value1 can be found, otherwise returns UNKNOWN.

Always returns UNKNOWN if value1 is NULL.

For example:

  • 4 NOT IN (1, 2, 3) returns TRUE;
  • 1 NOT IN (1, 2, NULL) returns FALSE;
  • 4 NOT IN (1, 2, NULL) returns UNKNOWN.

EXISTS (sub-query)

BOOLEAN

Returns TRUE if the subquery returns at least one row.

Only operations that can be overridden in join and grouping operations are supported. For streaming queries, this operation is rewritten in joins and grouping. The calculation of the query result required state may increase indefinitely based on the number of input rows.

Provide a query configuration with effective retention intervals to prevent excessive state.

value IN (sub-query)

BOOLEAN

Returns TRUE if value is equal to one row in the subquery result set.

value NOT IN (sub-query)

BOOLEAN

Returns TRUE if value is not contained in the rows returned by the subquery.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback