# Domain types

Domain types attach validation and useful comparison rules to a particular kind of value. UUID validates identifiers, IPv4 and IPv6 compare addresses numerically, and geometry aliases retain typed coordinate collections.

These are built-in types. CoordinatorDB does not provide a `CREATE DOMAIN` statement for defining additional SQL domains.

## Choosing a domain type

* [UUID](https://coordinatordb.com/docs/reference/data-types/uuid) stores a canonical identifier and supports generated version 4 and version 7 values.
* [IPv4](https://coordinatordb.com/docs/reference/data-types/ipv4) stores a four-byte address with numeric address ordering.
* [IPv6](https://coordinatordb.com/docs/reference/data-types/ipv6) stores an IPv6 address and normalizes its text representation.
* [Geometry types](https://coordinatordb.com/docs/reference/data-types/geometry-types) describe points, paths, rings and polygons using typed tuples and arrays.

For an address with a network prefix, use the `inet` or `cidr` types described with the [IP address functions](https://coordinatordb.com/docs/reference/functions/regular-functions/ip-address-functions).

## Example

### Validated identifiers and addresses

```sql
CREATE TABLE devices(id UUID PRIMARY KEY, address IPv4);
INSERT INTO devices VALUES
    ('550e8400-e29b-41d4-a716-446655440000', '10.0.0.2');
```

```sql
SELECT id, address
FROM devices
FORMAT csv;
```

```text
"550e8400-e29b-41d4-a716-446655440000","10.0.0.2"
```
