
-- Myself and my long-time star watching companion.
INSERT INTO observer
  (fname, minit, lname, honorific, mailing_addr, email_addr, phone_num, contact, bday, deceased)
VALUES
  ('Peter', 'C', 'Chapin', 'Dr', NULL, 'peter@pchapin.org', '802-522-6763', 'e', '1960-09-07', 'n'),
  ('Joseph', NULL, 'Roberts', 'Mr', NULL, NULL, NULL, NULL, '1960-11-17', 'n');


-- My usual observing location.
INSERT INTO location
  (owner_id, longitude, latitude, elevation, name)
VALUES
  (1, -72.553, 42.894, 293, 'Kelsey Mountain School House');


-- Simulated observations.
INSERT INTO observation
  (name, const, observer_id, location_id, datetime, brightness, notes)
VALUES
  ('AR', 'Aur', 1, 1, '2005-11-30 02:15:00-0500', 6.3, 'Some haze'),
  ('R', 'Aqr', 1, 1, '2005-09-07 04:25:00-0400', 8.5, NULL);

-- Alternate ways of inserting the ID numbers by looking them up in another table.
INSERT INTO observation
  (name, const, observer_id, location_id, datetime, brightness, notes)
SELECT 'AR', 'Aur', observer.id, location.id, '2005-11-30 02:15:00-0500', 6.3, 'Some haze'
FROM observer, location  -- This syntax is not a best practice.
WHERE observer.email_addr = 'peter@pchapin.org' AND location.name = 'Kelsey Mountain School House';

INSERT INTO observation
  (name, const, observer_id, location_id, datetime, brightness, notes)
SELECT 'R', 'Aqr', observer.id, location.id, '2005-09-07 04:25:00-0400', 8.5, NULL
FROM observer JOIN location
  ON observer.email_addr = 'peter@pchapin.org' AND location.name = 'Kelsey Mountain School House';
