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

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

CREATE TABLE Pet(
  pet_id INT PRIMARY KEY,
  name TEXT,
  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 (1,'Pet1',1);
INSERT INTO Pet VALUES (2,'Pet2',2);
INSERT INTO Pet VALUES (3,'Pet3',3);

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

-- This should fail
INSERT INTO Pet VALUES (4,'Pet3',1);
