clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 756629 fiddles created (13590 in the last week).

CREATE TABLE taxrate ( taxrate int PRIMARY KEY ); CREATE TABLE taxrate_standard( taxrate int PRIMARY KEY REFERENCES taxrate ); CREATE UNIQUE INDEX taxrate_standard_singleton ON taxrate_standard ((true)); -- makes it a singleton
 hidden batch(es)


INSERT INTO taxrate (taxrate) VALUES (42); INSERT INTO taxrate_standard (taxrate) VALUES (42);
1 rows affected
1 rows affected
 hidden batch(es)


INSERT INTO taxrate (taxrate) VALUES (1), (2);
2 rows affected
 hidden batch(es)


CREATE VIEW taxrate_combined AS SELECT t.*, (ts.taxrate = t.taxrate) AS standard FROM taxrate t LEFT JOIN taxrate_standard ts USING (taxrate); TABLE taxrate_combined;
taxrate standard
42 t
1
2
 hidden batch(es)