
// CF 7-2

// Incumbents table

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

// Actual insert

INSERT INTO Incumbents 
  SELECT 11122333,
         341288,
         DATE '12/05/1997',
         DATE '01/01/3000'
    FROM Incumbents
   WHERE NOT EXISTS (SELECT *
                      FROM Incumbents AS I2
                     WHERE Incumbents.SSN = I2.SSN
                       AND I2.EndDate = DATE '01/01/3000');

