> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Types

## Supported types

CockroachDB supports the following data types.

| Type | Description | Example |
| - | - | - |
| [`ARRAY`](/docs/stable/array) | A 1-dimensional, 1-indexed, homogeneous array of any non-array data type. | `{"sky","road","car"}` |
| [`BIT`](/docs/stable/bit) | A string of binary digits (bits). | `B'10010101'` |
| [`BOOL`](/docs/stable/bool) | A Boolean value. | `true` |
| [`BYTES`](/docs/stable/bytes) | A string of binary characters. | `b'\141\061\142\062\143\063'` |
| [`COLLATE`](/docs/stable/collate) | The `COLLATE` feature lets you sort [`STRING`](/docs/stable/string) values according to language- and country-specific rules, known as collations. | `'a1b2c3' COLLATE en` |
| [`DATE`](/docs/stable/date) | A date. | `DATE '2016-01-25'` |
| [`DECIMAL`](/docs/stable/decimal) | An exact, fixed-point number. | `1.2345` |
| [`ENUM`](/docs/stable/enum) | A user-defined data type comprised of a set of static values. | `ENUM ('club, 'diamond', 'heart', 'spade')` |
| [`FLOAT`](/docs/stable/float) | A 64-bit, inexact, floating-point number. | `1.2345` |
| [`INET`](/docs/stable/inet) | An IPv4 or IPv6 address. | `192.168.0.1` |
| [`INT`](/docs/stable/int) | A signed integer, up to 64 bits. | `12345` |
| [`INTERVAL`](/docs/stable/interval) | A span of time. | `INTERVAL '2h30m30s'` |
| [`NULL`](/docs/stable/null-handling) | The undefined value. | `NULL` |
| [`JSONB`](/docs/stable/jsonb) | JSON (JavaScript Object Notation) data. | `'{"first_name": "Lola", "last_name": "Dog", "location": "NYC", "online" : true, "friends" : 547}'` |
| [`OID`](/docs/stable/oid) | An unsigned 32-bit integer. | `4294967295` |
| [`SERIAL`](/docs/stable/serial) | A pseudo-type that combines an [integer type](/docs/stable/int.md) with a [`DEFAULT` expression](/docs/stable/default-value). | `148591304110702593` |
| [`STRING`](/docs/stable/string) | A string of Unicode characters. | `'a1b2c3'` |
| [`TIME` `TIMETZ`](/docs/stable/time) | `TIME` stores a time of day in UTC.  `TIMETZ` converts `TIME` values with a specified time zone offset from UTC. | `TIME '01:23:45.123456'`  `TIMETZ '01:23:45.123456-5:00'` |
| [`TIMESTAMP` `TIMESTAMPTZ`](/docs/stable/timestamp) | `TIMESTAMP` stores a date and time pairing in UTC. `TIMESTAMPTZ` converts `TIMESTAMP` values with a specified time zone offset from UTC. | `TIMESTAMP '2016-01-25 10:10:10'` `TIMESTAMPTZ '2016-01-25 10:10:10-05:00'` |
| [`TSQUERY`](/docs/stable/tsquery) | A list of lexemes and operators used in [full-text search](/docs/stable/full-text-search.md). | `'list' & 'lexem' & 'oper' & 'use' & 'full' & 'text' & 'search'` |
| [`TSVECTOR`](/docs/stable/tsvector) | A list of lexemes with optional integer positions and weights used in [full-text search](/docs/stable/full-text-search.md). | `'full':13 'integ':7 'lexem':4 'list':2 'option':6 'posit':8 'search':15 'text':14 'use':11 'weight':10` |
| [`UUID`](/docs/stable/uuid) | A 128-bit hexadecimal value. | `7f9c24e8-3b12-4fef-91e0-56a2d5a246ec` |
| [`VECTOR`](/docs/stable/vector) | A fixed-length array of floating-point numbers. | `[1.0, 0.0, 0.0]` |

## Data type conversions and casts

CockroachDB supports explicit type conversions using the following methods:

* `<type 'string literal'`, to convert from the literal representation of a value to a value of that type. For example:
  `DATE '2008-12-21'`, `INT '123'`, or `BOOL 'true'`.

* `<value::<data type`, or its equivalent longer form `CAST(<value AS <data type>)`, which converts an arbitrary expression of one built-in type to another (this is also known as type coercion or "casting"). For example:
  `NOW()::DECIMAL`, `VARIANCE(a+2)::INT`.

> [!TIP]
>
> To create constant values, consider using a
> type annotation
> instead of a cast, as it provides more predictable results.

* Other [built-in conversion functions](/docs/stable/functions-and-operators.md) when the type is not a SQL type, for example `from_ip()`, `to_ip()` to convert IP addresses between `STRING` and `BYTES` values.

CockroachDB also supports implicit casting from string literals to arrays of all data types except the following:

* [`BYTES`](/docs/stable/bytes)
* [`ENUM`](/docs/stable/enum)
* [`JSONB`](/docs/stable/jsonb)
* [`SERIAL`](/docs/stable/serial)
* `Box2D` [(spatial type)](/docs/stable/architecture/glossary.md#data-types)
* `GEOGRAPHY` [(spatial type)](/docs/stable/architecture/glossary.md#data-types)
* `GEOMETRY` [(spatial type)](/docs/stable/architecture/glossary.md#data-types)

For an example, see [Implicit casting to `ARRAY`s](/docs/stable/array#implicit-casting).

You can find each data type's supported conversion and casting on its
respective page in its section **Supported casting & conversion**.

## See also

* [`CREATE TYPE`](/docs/stable/create-type)
* [`ALTER TYPE`](/docs/stable/alter-type)
* [`DROP TYPE`](/docs/stable/drop-type)
* [`SHOW TYPES`](/docs/stable/show-types)
