CREATE TABLE  pets (
        pet_name TEXT DEFAULT 'stringValue' NOT NULL PRIMARY KEY ,
        pet_age INTEGER  NOT NULL
)  ;
INSERT INTO pets(pet_age,pet_name) VALUES (3,'Fido');
INSERT INTO pets(pet_age,pet_name) VALUES (5,'Fluffy');
INSERT INTO pets(pet_age,pet_name) VALUES (0,'Jimminy');
INSERT INTO pets(pet_age,pet_name) VALUES (2,'Vigo');
CREATE TABLE  houses (
        house_id SERIAL  NOT NULL PRIMARY KEY ,
        type TEXT  NOT NULL
)  ;
CREATE UNIQUE INDEX houses_type_idx ON houses (type) ;
INSERT INTO houses(type,house_id) VALUES ('cage',0);
INSERT INTO houses(type,house_id) VALUES ('dog house',1);
INSERT INTO houses(type,house_id) VALUES ('dog basket',2);
INSERT INTO houses(type,house_id) VALUES ('cat basket',3);
INSERT INTO houses(type,house_id) VALUES ('bowl',4);
INSERT INTO houses(type,house_id) VALUES ('acquarium',5);
CREATE TABLE  house_pets (
        house_id INTEGER  NOT NULL REFERENCES houses ON DELETE CASCADE ON UPDATE CASCADE ,
        pet_name TEXT  NOT NULL ,
        FOREIGN KEY (pet_name) REFERENCES pets (pet_name) ON DELETE SET NULL ON UPDATE CASCADE
)  ;
INSERT INTO house_pets(pet_name,house_id) VALUES ('Fido',1);

