
// CF 7-11

// Incumbents table

CREATE TABLE Incumbents (
                        SSN             integer,
                        PCN             integer,
                        StartDate       date,
                        EndDate         date,
                        PRIMARY KEY (SSN, PCN)
                        );

// Actual modifications

INSERT INTO Incumbents
   SELECT 111223333,
          908739,
          DATE '12/05/1997',
          EndDate
     FROM Incumbents
    WHERE SSN = 111223333
      AND StartDate <= DATE '12/05/1997'
      AND EndDate > DATE '12/05/1997';

UPDATE Incumbents
  SET EndDate = DATE '12/05/1997'
WHERE SSN = 111223333
  AND PCN <> 908739
  AND StartDate < DATE '12/05/1997'
  AND EndDate > DATE '12/05/1997';

UPDATE Incumbents
   SET PCN = 908739
 WHERE SSN = 111223333
   AND StartDate >= DATE '12/05/1997';

