# Unsigned Integer types
Express unsigned integers

> For the complete documentation index, see [llms.txt](https://preview.materialize.com/materialize/40269/llms.txt).


## `uint2` info

Detail | Info
-------|------
**Size** | 2 bytes
**Catalog name** | `mz_catalog.uint2`
**OID** | 16,460
**Range** | [0, 65,535]

## `uint4` info

Detail | Info
-------|------
**Size** | 4 bytes
**Catalog name** | `mz_catalog.uint4`
**OID** | 16,462
**Range** | [0, 4,294,967,295]

## `uint8` info

Detail | Info
-------|------
**Size** | 8 bytes
**Catalog name** | `mz_catalog.uint8`
**OID** | 14,464
**Range** | [0, 18,446,744,073,709,551,615]

## Details

### Valid casts

For details about casting, including contexts, see [Functions:
Cast](https://preview.materialize.com/materialize/40269/markdown-docs/sql/functions/cast/index.md).

#### Between unsigned integer types

From    | To      | Required context
--------|---------|--------
`uint2` | `uint4` | Implicit
`uint2` | `uint8` | Implicit
`uint4` | `uint2` | Assignment
`uint4` | `uint8` | Implicit
`uint8` | `uint2` | Assignment
`uint8` | `uint4` | Assignment

#### From unsigned integer types

You can cast unsigned integer types to:

To | Required context
---|--------
[`numeric`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/numeric/index.md) | Implicit
[`real`/`double precision`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/float/index.md) | Implicit
[`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) | Assignment
[`smallint`/`integer`/`bigint`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/integer/index.md) | Depends on specific cast

#### To `uint4` or `uint8`

You can cast the following types to unsigned integer types:

From | Required context
---|--------
[`boolean`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/boolean/index.md) (`integer` only) | Explicit
[`jsonb`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/jsonb/index.md) | Explicit
[`oid`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/oid/index.md) (`integer` and `bigint` only) | Assignment
[`numeric`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/numeric/index.md) | Assignment
[`real`/`double precision`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/float/index.md) | Assignment
[`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) | Explicit
[`smallint`/`integer`/`bigint`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/integer/index.md) | Depends on specific cast

## Examples

```mzsql
SELECT 123::uint4 AS int_v;
```
```nofmt
 int_v
-------
   123
```

<hr/>

```mzsql
SELECT 1.23::uint4 AS int_v;
```
```nofmt
 int_v
-------
     1
```
