What happens when you insert an empty string into a required field?
In the iv_users table, the topics column is declared VARCHAR(50) NOT NULL (in ClickHouse, it's a non-Nullable string column). The application inserts a user with an empty string '' as the value of topics. Will the insert succeed? Which rows will the final SELECT return?
Predict the resultDDL, keys, and normalizationJuniorBackendQAData Engineer
Input data · iv_users
| id | topics | |
|---|---|---|
| 1 | ann@example.com | sql,python |
| 2 | NULL | mysql |
| 3 | boris@example.com | python,sql |
| 4 | clara@example.com | nosql,go |
| 5 | dan@example.com | sql |
Query
INSERT INTO iv_users (id, email, topics)
VALUES (6, 'eve@example.com', '');
SELECT id, topics
FROM iv_users
WHERE id = 6
ORDER BY id