# 6.2.3 BOTTOM

Part of: [6 Language](6-language.md) › [6.2 Processing](6-2-processing.md)

### Syntax

**BOTTOM** {_bottom_value_ | {**,** _subbottom_value_} | {_bottom_value_**,** _subbottom_value_}}

### Description

Truncate a result set after position _bottom_value_ from the bottom. In other words, all elements before position _bottom_value_ are discarded from the result set. Additionally, if the result set is of data type [HDFQL_CHAR](5-1-constants.md#hdfql_char), [HDFQL_VARTINYINT](5-1-constants.md#hdfql_vartinyint), [HDFQL_UNSIGNED_VARTINYINT](5-1-constants.md#hdfql_unsigned_vartinyint), [HDFQL_VARSMALLINT](5-1-constants.md#hdfql_varsmallint), [HDFQL_UNSIGNED_VARSMALLINT](5-1-constants.md#hdfql_unsigned_varsmallint), [HDFQL_VARINT](5-1-constants.md#hdfql_varint), [HDFQL_UNSIGNED_VARINT](5-1-constants.md#hdfql_unsigned_varint), [HDFQL_VARBIGINT](5-1-constants.md#hdfql_varbigint), [HDFQL_UNSIGNED_VARBIGINT](5-1-constants.md#hdfql_unsigned_varbigint), [HDFQL_VARFLOAT](5-1-constants.md#hdfql_varfloat), [HDFQL_VARDOUBLE](5-1-constants.md#hdfql_vardouble), or [HDFQL_OPAQUE](5-1-constants.md#hdfql_opaque), the result subset can be truncated from the bottom by specifying _subbottom_value_.

### Parameter(s)

_bottom_value_ – optional integer that specifies the position of the truncation of a result set from the bottom. If negative, the BOTTOM option behaves as the TOP option with a positive _bottom_value_.

_subbottom_value_ – optional integer that specifies the position of the truncation of a result set from the bottom. If negative, the BOTTOM option behaves as the TOP option with a positive _subbottom_value_. Of note, this parameter is only applicable to a result set of one of the aforementioned data types and is ignored otherwise.

### Return

The result set and/or subset is truncated from the bottom according to the specified position.

### Example(s)

```hdfql
# create an HDF5 dataset named "my_dataset0" of data type float of four dimensions (size 5x8x4x7)
CREATE DATASET my_dataset0 AS FLOAT(5, 8, 4, 7)

# show (i.e. get) dimensions of dataset "my_dataset0" and populate cursor in use with these (should return 5, 8, 4, 7)
SHOW DIMENSION my_dataset0

# show (i.e. get) dimensions of dataset "my_dataset0" and populate cursor in use with the bottommost (i.e. last) dimension (should return 7)
SHOW DIMENSION my_dataset0 BOTTOM 1

# show (i.e. get) dimensions of dataset "my_dataset0" and populate cursor in use with the two bottommost dimensions (should return 4, 7)
SHOW DIMENSION my_dataset0 BOTTOM 2

# show (i.e. get) dimensions of dataset "my_dataset0" and populate cursor in use with the two topmost dimensions (should return 5, 8)
SHOW DIMENSION my_dataset0 BOTTOM -2

# create an HDF5 dataset named "my_dataset1" of data type variable-length int of one dimension (size 3) with initial values of 12, 14, and 16 for the first position, 18 for the second position, and 20, 22, 24, and 26 for the third position
CREATE DATASET my_dataset1 AS VARINT(3) VALUES((12, 14, 16), (18), (20, 22, 24, 26))

# select (i.e. read) data from dataset "my_dataset1" and populate cursor in use with it (should return 12, 14, 16, 18, 20, 22, 24, 26)
SELECT FROM my_dataset1

# select (i.e. read) data from dataset "my_dataset1" and populate cursor in use with values of the bottommost (i.e. last) position (should return 20, 22, 24, 26)
SELECT FROM my_dataset1 BOTTOM 1

# select (i.e. read) data from dataset "my_dataset1" and populate cursor in use with values of the two bottommost positions (should return 14, 16, 18, 24, 26)
SELECT FROM my_dataset1 BOTTOM , 2

# select (i.e. read) data from dataset "my_dataset1" and populate cursor in use with the bottommost value of the two topmost positions (should return 16, 18)
SELECT FROM my_dataset1 BOTTOM -2, 1
```
