Comparison

Comparison operators

OperatorDescription

<

>

<=

>=

=

==

Equal (non-standard but popular syntax)

<>

!=

Not equal (non-standard but popular syntax)

Less than

Returns true when the first value is less than the second value (e.g. 2 < 1 returns false while 1 < 2 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal < 500
    LIMIT 3;

Query result

orderidnettotal

229NOEFdC5

0

uCTz0C6fB8

128

FGliNwk2lb

381.21

Greater than

Returns true when the first value is greater than the second value (e.g. 1 > 2 returns false while 2 > 1 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal > 500
    LIMIT 3;

Query result

orderidnettotal

BegfDveBnB

865.4

nxeYxV9ojw

1261.62

RVsaqkW46f

2549.26

Less than or equal to

Returns true when the first value is less than or equal to the second value (e.g. 1.1 <= 1 returns false while 1 <= 1 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal <= 500
    LIMIT 3;

Query result

orderidnettotal

UJvGCRv2hO

217.98

k95KKOBHxi

231.03

Ba3bKHFKvq

0

Greater than or equal to

Returns true when the first value is greater than or equal to the second value (e.g. 1 >= 1.1 returns false while 1 >= 1 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        nettotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND nettotal >= 500
    LIMIT 3;

Query result

orderidnettotal

ShCjHSzsEy

817.18

BJNVAJHS97

1145.89

9TyAPyua8A

1913.95

Equal

Returns true when the first value is equal to the second value (e.g. 1 = 2 returns false while 1 = 1 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        shippinginfo_address_city
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND shippinginfo_address_state = 'NY'
    LIMIT 3;

Query result

orderidshippinginfo_address_city

SDdDy6C7qO

Rochester

8ZNYcSSY0B

East Meadow

8lfbwMVMoY

Shirley

Not equal

Returns true when the first value is equal to the second value (e.g. 1 != 1 returns false while 1 != 2 would return true).

Example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        orderid,
        shippinginfo_address_state
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE ($commit_time BETWEEN run_start_time() AND run_end_time())
    AND shippinginfo_address_state != 'NY'
    LIMIT 3;

Query result

orderidshippinginfo_address_state

aMIV6S5euH

ND

mRmHJfMDey

MD

UCQjGukrlW

KY

Last updated