title: SQL database - PK and FK's
body: <p>This is my code already, this was based off a template but mine doesn't work, comes up with errors about too many primary keys and missing keywords for the alter tables? </p>
  
  <p>I'm not sure where to even start. If I try to insert any data then that just throws up errors too with missing expressions?</p>
  
  <pre><code>CREATE TABLE staff
  (
     staff_id          INTEGER NOT NULL PRIMARY KEY,
     staff_name        VARCHAR (30) NOT NULL,
     staff_surname     VARCHAR (30) NOT NULL,
     branch            VARCHAR (10) NOT NULL,
     jobrole           VARCHAR (15) NOT NULL,
     staff_contactno   INTEGER NOT NULL,
     CONSTRAINT pk_staff PRIMARY KEY (staff_id)
  );
  
  
  CREATE TABLE property
  (
     property_id           INTEGER NOT NULL PRIMARY KEY,
     owner_id              INTEGER NOT NULL,
     property_addressln1   VARCHAR (50) NOT NULL,
     property_addressln2   VARCHAR (50) NOT NULL,
     property_county       VARCHAR (26) NOT NULL,
     property_postcode     VARCHAR (7) NOT NULL,
     property_type         VARCHAR (15) NOT NULL,
     property_bedrooms     INTEGER NOT NULL,
     availability          VARCHAR (15) NOT NULL,
     valuation             INTEGER NOT NULL,
     fk1_owner_id          INTEGER NOT NULL,
     fk2_staff_id          INTEGER NOT NULL,
     fk3_client_id         INTEGER NOT NULL,
     CONSTRAINT pk_property PRIMARY KEY (property_id, fk1_owner_id)
  );
  
  CREATE TABLE owner
  (
     owner_id           INTEGER NOT NULL PRIMARY KEY,
     owner_name         VARCHAR (30) NOT NULL,
     owner_surname      VARCHAR (30) NOT NULL,
     owner_addressln1   VARCHAR (50) NOT NULL,
     owner_addressln2   VARCHAR (50) NOT NULL,
     owner_county       VARCHAR (26) NOT NULL,
     owner_postcode     VARCHAR (7) NOT NULL,
     owner_contactno    INTEGER NOT NULL,
     owner_email        VARCHAR (50) NOT NULL UNIQUE,
     CONSTRAINT pk_owner PRIMARY KEY (owner_id)
  );
  
  CREATE TABLE client
  (
     client_id          INTEGER NOT NULL PRIMARY KEY,
     client_name        VARCHAR (30) NOT NULL,
     client_surname     VARCHAR (30) NOT NULL,
     client_contactno   INTEGER NOT NULL,
     client_email       VARCHAR (50) NOT NULL,
     CONSTRAINT pk_client PRIMARY KEY (client_id)
  );
  
  ALTER TABLE property ADD CONSTRAINT fk1_property_to_owner FOREIGN KEY(fk1_owner_id) REFERENCES owner(owner_id) ON DELETE restrict on update cascade;
  
  
  
  ALTER TABLE property ADD CONSTRAINT fk2_property_to_staff FOREIGN KEY(fk2_staff_id) REFERENCES staff(staff_id) ON DELETE restrict on update cascade;
  
  
  ALTER TABLE property ADD CONSTRAINT
  fk3_property_to_client FOREIGN KEY(fk3_client_id) REFERENCES client(client_id) ON DELETE restrict on update cascade;
  </code></pre>