

# Use PartiQL functions with DynamoDB
<a name="ql-functions"></a>

PartiQL in Amazon DynamoDB supports the following built-in variants of SQL standard functions.

**Note**  
Any SQL functions that are not included in this list are not currently supported in DynamoDB.

## Aggregate functions
<a name="ql-functions.aggregate"></a>
+ [Using the SIZE function with PartiQL for amazon DynamoDB](ql-functions.size.md)

## Conditional functions
<a name="ql-functions.conditional"></a>
+ [Using the EXISTS function with PartiQL for DynamoDB](ql-functions.exists.md)
+ [Using the ATTRIBUTE\$1TYPE function with PartiQL for DynamoDB](ql-functions.attribute_type.md)
+ [Using the BEGINS\$1WITH function with PartiQL for DynamoDB](ql-functions.beginswith.md)
+ [Using the CONTAINS function with PartiQL for DynamoDB](ql-functions.contains.md)
+ [Using the MISSING function with PartiQL for DynamoDB](ql-functions.missing.md)

# Using the EXISTS function with PartiQL for DynamoDB
<a name="ql-functions.exists"></a>

You can use EXISTS to perform the same function as `ConditionCheck` does in the [TransactWriteItems](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html#transaction-apis-txwriteitems) API. The EXISTS function can only be used in transactions.

Given a value, returns `TRUE` if the value is a non-empty collection. Otherwise, returns `FALSE`.

**Note**  
This function can only be used in transactional operations.

## Syntax
<a name="ql-functions.exists.syntax"></a>

```
EXISTS ( statement )
```

## Arguments
<a name="ql-functions.exists.arguments"></a>

*statement*  
(Required) The SELECT statement that the function evaluates.  
The SELECT statement must specify a full primary key and one other condition.

## Return type
<a name="ql-functions.exists.return-type"></a>

`bool`

## Examples
<a name="ql-functions.exists.examples"></a>

```
EXISTS(
    SELECT * FROM "Music" 
    WHERE "Artist" = 'Acme Band' AND "SongTitle" = 'PartiQL Rocks')
```

# Using the BEGINS\$1WITH function with PartiQL for DynamoDB
<a name="ql-functions.beginswith"></a>

Returns `TRUE` if the attribute specified begins with a particular substring.

## Syntax
<a name="ql-functions.beginswith.syntax"></a>

```
begins_with(path, value )
```

## Arguments
<a name="ql-functions.beginswith.arguments"></a>

*path*  
(Required) The attribute name or document path to use.

*value*  
(Required) The string to search for.

## Return type
<a name="ql-functions.beginswith.return-type"></a>

`bool`

## Examples
<a name="ql-functions.beginswith.examples"></a>

```
SELECT * FROM "Orders" WHERE "OrderID"=1 AND begins_with("Address", '7834 24th')
```

# Using the MISSING function with PartiQL for DynamoDB
<a name="ql-functions.missing"></a>

Returns `TRUE` if the item does not contain the attribute specified. Only equality and inequality operators can be used with this function.

## Syntax
<a name="ql-functions.missing.syntax"></a>

```
 attributename IS | IS NOT  MISSING 
```

## Arguments
<a name="ql-functions.missing.arguments"></a>

*attributename*  
(Required) The attribute name to look for.

## Return type
<a name="ql-functions.missing.return-type"></a>

`bool`

## Examples
<a name="ql-functions.missing.examples"></a>

```
SELECT * FROM Music WHERE "Awards" is MISSING
```

# Using the ATTRIBUTE\$1TYPE function with PartiQL for DynamoDB
<a name="ql-functions.attribute_type"></a>

Returns `TRUE` if the attribute at the specified path is of a particular data type.

## Syntax
<a name="ql-functions.attribute_type.syntax"></a>

```
attribute_type( attributename, type )
```

## Arguments
<a name="ql-functions.attribute_type.arguments"></a>

*attributename*  
(Required) The attribute name to use.

*type*  
(Required) The attribute type to check for. For a list of valid values, see DynamoDB [attribute\$1type](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions).

## Return type
<a name="ql-functions.attribute_type.return-type"></a>

`bool`

## Examples
<a name="ql-functions.attribute_type.examples"></a>

```
SELECT * FROM "Music" WHERE attribute_type("Artist", 'S')
```

# Using the CONTAINS function with PartiQL for DynamoDB
<a name="ql-functions.contains"></a>

Returns `TRUE` if the attribute specified by the path is one of the following:
+ A String that contains a particular substring. 
+ A Set that contains a particular element within the set.

For more information, see the DynamoDB [contains](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions) function. 

## Syntax
<a name="ql-functions.contains.syntax"></a>

```
contains( path, substring )
```

## Arguments
<a name="ql-functions.contains.arguments"></a>

*path*  
(Required) The attribute name or document path to use.

*substring*  
(Required) The attribute substring or set member to check for. For more information, see the DynamoDB [contains](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions) function.

## Return type
<a name="ql-functions.contains.return-type"></a>

`bool`

## Examples
<a name="ql-functions.contains.examples"></a>

```
SELECT * FROM "Orders" WHERE "OrderID"=1 AND contains("Address", 'Kirkland')
```

# Using the SIZE function with PartiQL for amazon DynamoDB
<a name="ql-functions.size"></a>

Returns a number representing an attribute's size in bytes. The following are valid data types for use with size. For more information, see the DynamoDB [size](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions) function.

## Syntax
<a name="ql-functions.size.syntax"></a>

```
size( path)
```

## Arguments
<a name="ql-functions.size.arguments"></a>

*path*  
(Required) The attribute name or document path.   
For supported types, see DynamoDB [size](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions) function.

## Return type
<a name="ql-functions.size.return-type"></a>

`int`

## Examples
<a name="ql-functions.size.examples"></a>

```
 SELECT * FROM "Orders" WHERE "OrderID"=1 AND size("Image") >300
```