Click to copy
Tables • Reviewed for ksqlDB 0.29
How to Insert Rows into a Table in ksqlDB
This is an example of adding a new row or record to a ksqlDB table:
INSERT INTO scores_table (
student_id,
name,
score
) VALUES (
1,
'Alice',
4
);
The scores_table
was created with the statement below:
CREATE TABLE scores_table (
student_id BIGINT PRIMARY KEY,
name STRING,
score DOUBLE
) WITH (
KAFKA_TOPIC = 'scores_topic',
VALUE_FORMAT = 'JSON',
PARTITIONS = 10
);
You can runINSERT
statements regardless if a table is materialized or not. What you cannot do though, is to insert records into a table marked with theSOURCE
modifier when it was created. See an example here.
Was this article helpful?