Will the table accept a second row with the same primary key?
In PostgreSQL and MySQL, the id column is the primary key of the iv_departments table. In ClickHouse, the table was created with ENGINE = MergeTree ORDER BY id, which also makes id its primary key. The query inserts a department with an existing id = 1, then retrieves all rows with that id. What will the query return? The behavior depends on the database. Select the database and indicate the result. If the query fails, select “Error.”
Predict the resultIndexesSeniorData EngineerBackend
Input data · iv_departments
| id | name |
|---|---|
| 1 | Sales |
| 2 | Engineering |
| 3 | Analytics |
| 4 | Legal |
Query
INSERT INTO iv_departments (id, name) VALUES (1, 'Support');
SELECT id, name
FROM iv_departments
WHERE id = 1
ORDER BY name