-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE TABLE postby (
    postnr INTEGER NOT NULL PRIMARY KEY,
    postby VARCHAR(20)
)
GO
CREATE TABLE addresse (
    id INTEGER NOT NULL PRIMARY KEY,
    vejnavn VARCHAR(50),
    vejnr INTEGER,
    postnr INTEGER CONSTRAINT postnr_fk_c REFERENCES postby(postnr)
)
GO
INSERT INTO postby VALUES(1111,'A By')
GO
INSERT INTO postby VALUES(2222,'B By')
GO
INSERT INTO addresse VALUES(1, 'A Vej', 1, 1111)
GO
INSERT INTO addresse VALUES(2, 'B Vej', 2, 2222)
GO
DELETE FROM postby WHERE postnr < 1500
GO
DROP TABLE addresse
GO
DROP TABLE postby
GO
