DROP SCHEMA IF EXISTS lecture7ex3a CASCADE;
CREATE SCHEMA lecture7ex3a;
SET SCHEMA 'lecture7ex3a';

CREATE TABLE Person (
  ssn INT PRIMARY KEY,
  name TEXT NOT NULL
);

CREATE TABLE Pet(
  name TEXT PRIMARY KEY,
  ssn INT REFERENCES Person NOT NULL
);


INSERT INTO Person VALUES (1, 'Name1');
INSERT INTO Person VALUES (2, 'Name2');
INSERT INTO Person VALUES (3, 'Name3');

INSERT INTO Pet VALUES ('Pet1',1);
INSERT INTO Pet VALUES ('Pet2',2);
INSERT INTO Pet VALUES ('Pet3',3);

-- This fails 
--INSERT INTO Pet VALUES ('Pet3',1);
