Differential privacy SQL reference

This topic provides the following information:

  • A reference for the SQL functions that are unique to differential privacy.
  • A list of the Snowflake data types, operators, query syntax, and functions that are supported by differential privacy.

Differential privacy functions

The following functions are unique to differential privacy.

FunctionDescription
DP_INTERVAL_LOWReturns the lower bound of the noise interval.
DP_INTERVAL_HIGHReturns the upper bound of the noise interval.

Data types

The following data types are supported.

Data typeNotes
BOOLEAN
CHAR, CHARACTER
DATE
DATETIME
DECIMAL, NUMERIC
DOUBLE, DOUBLE PRECISION, REAL
FLOAT, FLOAT4, FLOAT8
INT, INTEGER , BIGINT, SMALLINT, TINYINT, BYTEINT
NUMBER
STRING
TEXT
TIME
TIMESTAMP, TIMESTAMP_NTZTime data types with time zones are not supported. Use TIMESTAMP or TIMESTAMP_NTZ.
VARCHAR

Query syntax

The following elements of the Snowflake query syntax are supported.

SyntaxNotes
SELECT
SELECT ALL
FROM
INNER JOIN ONSee Supported joins.
INNER JOIN USINGSee Supported joins.
LEFT OUTER JOIN ONSee Supported joins.
LEFT OUTER JOIN USINGSee Supported joins.
RIGHT OUTER JOIN ONSee Supported joins.
RIGHT OUTER JOIN USINGSee Supported joins.
FULL OUTER JOIN ONSee Supported joins.
FULL OUTER JOIN USINGSee Supported joins.
NATURAL JOINSee Supported joins.
WHERE
GROUP BYAliases are not supported in the GROUP BY clause. For example, GROUP BY col_a AS column_a is not supported.
Limitations on query syntax

Quoted identifiers (for example, column, table, schema and database names) are not supported.

Operators

Arithmetic operators

The following arithmetic operators are supported.

OperatorNotes
- (unary)
-
+ (unary)Does not work with strings.
+
*
/
%

Comparison operators

The following comparison operators are supported.

OperatorNotes
=
!=
<
>
<=
>=

Logical operators

The following logical operators are supported.

OperatorNotes
AND
NOT
OR

Set operators

The following set operators are supported.

OperatorNotes
UNION [ ALL ]

Subquery operators

Subquery operators are not supported.

Functions

Aggregate functions

The following aggregate functions are supported.

FunctionNotes
ANY_VALUESupported only as an aggregate for a subquery with a GROUP BY clause.
COUNT
COUNT DISTINCT

Bitwise expression functions

Bitwise expression functions are not supported.

Conditional expression functions

The following conditional expression functions are supported.

FunctionNotes
[ NOT ] IN
CASE
COALESCE
DECODE
EQUAL_NULL
GREATEST
IFF
IS [NOT] NULL
LEAST

Context functions

Context functions are not supported.

Conversion functions

The following conversion functions are supported.

FunctionNotes
CAST, ::

Columns must be explicitly non-null to be casted. To do this, filter out nulls before casting.

Casting other data types to STRING is not supported.

TO_BOOLEAN
TO_CHAR , TO_VARCHAR
TO_DECIMAL , TO_NUMBER , TO_NUMERIC
TO_DOUBLE
TRY_CAST
TRY_TO_BOOLEAN
TRY_TO_DECIMAL, TRY_TO_NUMBER, TRY_TO_NUMERIC
TRY_TO_DOUBLE

Data generation functions

Data generation functions are not supported.

Data metric functions

Data metric functions are not supported. User-defined DMFs are also not supported.

Date & time functions

The following date & time functions are supported.

FunctionNotes
DATE_PARTThe following date and time parts are not supported: dayofweek, week, yearofweek, nanosecond, epoch_*, and timezone_*.
DAYNAME
EXTRACTThe following date and time parts are not supported: dayofweek, week, yearofweek, nanosecond, epoch_*, and timezone_*.
HOUR
LAST_DAY
MINUTE
SECOND
TRUNC
YEAR* / DAY* / WEEK* / MONTH / QUARTER

Encryption functions

Encryption functions are not supported.

File functions

File functions are not supported.

Geospatial functions

Geospatial functions are not supported.

Hash functions

Hash functions are not supported.

Metadata functions

Metadata functions are not supported.

Numeric functions

The following numeric functions are supported.

FunctionNotes
ABS
CEIL
FLOOR
MOD
SIGN

Regular expression functions

Regular expression functions are not supported.

Semi-structured and structured data functions

Semi-structured and structured data functions are not supported.

String and binary functions

The following string & binary functions are supported.

FunctionNotes
CONTAINS
LENGTH , LEN
LOWER
POSITION
UPPER

System functions

System functions are not supported.

Table functions

Table functions are not supported.