Insert data
INSERT adds rows through a common set of destination type and constraint checks. Choose the input path according to where the data already lives.
Literal and query input
Use VALUES for explicit rows and INSERT SELECT to copy or transform rows produced by a query. A column list can leave other columns to their SQL defaults.
CREATE TABLE items(id INTEGER PRIMARY KEY, name String DEFAULT 'unknown');
INSERT INTO items(id) VALUES (1), (2);SELECT id, name
FROM items
ORDER BY id
FORMAT csv;1,"unknown"
2,"unknown"Formats and files
INSERT FORMAT decodes a registered input format. The native client can send stdin or read local files with FROM INFILE, including supported compression. Every row from one file-input INSERT belongs to one statement.
For inline data, place SETTINGS before FORMAT and send later SQL in another request. HTTP can supply INSERT SQL in the query parameter and format bytes in the body.
All input paths validate target declarations and constraints. See INSERT INTO, batch inserts and the format guide.