Rudolf Adamkovič Personal site


Example: Constraining tables to exactly one row

CREATE TABLE t(v, singleton BOOL UNIQUE DEFAULT TRUE CHECK(singleton = TRUE));
INSERT INTO t(v) VALUES (10);
INSERT OR REPLACE INTO t(v) VALUES (20);
SELECT * FROM t;
vsingleton
201

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.