# Insert rows from another table

`INSERT INTO ... SELECT` copies a query result into an existing table. Name the destination columns so the mapping remains visible and does not accidentally depend on a later schema change.

```sql
CREATE TABLE current_items(id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE copied_items(id INTEGER PRIMARY KEY, name TEXT);
INSERT INTO current_items VALUES (1, 'Notebook'), (2, 'Pen');

INSERT INTO copied_items(id, name)
SELECT id, name FROM current_items;

SELECT id, name FROM copied_items ORDER BY id FORMAT csv;
```

The destination's declared types, primary keys, uniqueness and other constraints still apply. Running the same copy twice is not automatically safe: it can encounter existing keys or append duplicate rows, depending on the table definition. Decide whether a repeated operation should fail, skip conflicts or replace values before choosing a conflict policy.

For a new independent table, `CREATE TABLE ... AS SELECT` copies projected values and retains projected native declarations, but it does not copy source constraints. Define the destination explicitly when those constraints matter. Group the copy with related changes in a transaction when they must commit together.

See [`INSERT INTO`](https://coordinatordb.com/docs/reference/statements/insert-into) and [`CREATE TABLE`](https://coordinatordb.com/docs/reference/statements/create/table).
