# Create a table

This quickstart creates a table of events with a primary key, a required text field and an exact decimal amount.

Start the server, then connect with `./coordinator client --database data`. Use a database where the sample table name is available.

## Create the table

```sql
CREATE TABLE events
(
    id INTEGER PRIMARY KEY,
    kind String NOT NULL,
    amount Decimal(18, 2)
);
```

`INTEGER PRIMARY KEY` gives each row an integer identifier. `NOT NULL` requires a kind. `Decimal(18, 2)` retains two exact fractional digits.

## Insert rows

```sql
INSERT INTO events VALUES
    (1, 'view', '1.20'),
    (2, 'click', '2.40');
```

The amount strings are converted to the declared Decimal type and checked before storage.

## Read the result

```sql
SELECT id, kind, amount
FROM events
ORDER BY id
FORMAT csv;
```

```text
1,"view",1.20
2,"click",2.40
```

`ORDER BY` defines the row order. `FORMAT csv` selects a server output format; omitting it uses the default table display.

Continue with [writing queries](https://coordinatordb.com/docs/get-started/quickstarts/writing-queries), or consult [`CREATE TABLE`](https://coordinatordb.com/docs/reference/statements/create/table) for constraints, defaults and generated columns.
