ALTER TABLE person ADD COLUMN dead INTEGER;

ALTER TABLE person ADD COLUMN phone_number TEXT;

ALTER TABLE person ADD COLUMN salary FLOAT;

ALTER TABLE person ADD COLUMN dob DATETIME;

ALTER TABLE pet ADD COLUMN dob DATETIME;

ALTER TABLE person_pet ADD COLUMN purchased_on DATETIME;

ALTER TABLE pet ADD COLUMN parent INTEGER;

UPDATE pet
SET parent = 0
WHERE id IN (
    SELECT pet_id
    FROM person_pet
    WHERE person_id = 0
);

UPDATE person_pet
SET purchased_on = DATETIME('now')
WHERE person_id = 0;

INSERT INTO person (
    id, first_name, last_name, age, dob,
    dead, phone_number, salary
)
VALUES (
    1, 'Fred', 'Shub', 43, DATETIME('1971-12-23 11:23:00'),
    0, '4128898282', 45390.80
);

INSERT INTO person (
    id, first_name, last_name, age, dob,
    dead, phone_number, salary
)
VALUES (
    2, 'Alice', 'Blurb', 27, DATETIME('1987-02-03 01:15:00'),
    0, '7243871222', 89500.00
);

INSERT INTO person (
    id, first_name, last_name, age, dob,
    dead, phone_number, salary
)
VALUES (
    3, 'Regina', 'Nerp', 19, DATETIME('1995-09-12 19:04:00'),
    0, '4154401190', 142880.70
);

INSERT INTO person (
    id, first_name, last_name, age, dob,
    dead, phone_number, salary
)
VALUES (
    4, 'Sam', 'Wut', 59, DATETIME('1955-10-25 21:31:10'),
    0, '4125511328', 62422.00
);

INSERT INTO pet (
    id, name, breed, age, dead,
    dob, parent
)
VALUES (
    2, 'Hanky', 'Bone', 94, 0,
    DATETIME('1920-03-14 04:13:00'), 4
);

INSERT INTO pet (
    id, name, breed, age, dead,
    dob, parent
)
VALUES (
    3, 'Rhonda', 'Guinea Pig', 1, 0,
    DATETIME('2013-01-11 00:00:00'), 2
);

INSERT INTO pet (
    id, name, breed, age, dead,
    dob, parent
)
VALUES (
    4, 'Tippy', 'Dog', 18, 1,
    DATETIME('1996-10-04 00:00:00'), 1
);

INSERT INTO pet (
    id, name, breed, age, dead,
    dob, parent
)
VALUES (
    5, 'Chuck', 'Parakeet', 3, 0,
    DATETIME('2010-07-05 00:00:00'), 3
);

INSERT INTO pet (
    id, name, breed, age, dead,
    dob, parent
)
VALUES (
    6, 'Sal', 'Horse', 8, 0,
    DATETIME('2006-05-21 00:00:00'), 2
);

INSERT INTO person_pet (
    person_id, pet_id, purchased_on
)
VALUES (
    2, 6, DATETIME('2007-03-11 00:00:00')
);

INSERT INTO person_pet (
    person_id, pet_id, purchased_on
)
VALUES (
    4, 2, DATETIME('1955-11-05 00:00:00')
);

INSERT INTO person_pet (
    person_id, pet_id, purchased_on
)
VALUES (
    2, 3, DATETIME('2013-09-01 00:00:00')
);

INSERT INTO person_pet (
    person_id, pet_id, purchased_on
)
VALUES (
    1, 4, DATETIME('1999-01-25 00:00:00')
);

INSERT INTO person_pet (
    person_id, pet_id, purchased_on
)
VALUES (
    3, 5, DATETIME('2010-12-15 00:00:00')
);
