-- Create and connect to database
CREATE DATABASE TESTDB;


-- Create contacts table
CREATE TABLE "ADMINISTRATOR"."CONTACTS" (
  "ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY
  (START WITH 1, INCREMENT BY 1),
  "FIRSTNAME" VARCHAR(15) NOT NULL,
  "LASTNAME" VARCHAR(15) NOT NULL,
  "COMPANY" VARCHAR(20),
  "ADDRESS" VARCHAR(30),
  "PHONE" VARCHAR(15),
  "EMAIL" VARCHAR(30),
  "FAX" VARCHAR(15) )
  IN "USERSPACE1";
COMMENT ON TABLE "ADMINISTRATOR"."CONTACTS" IS 'A list of contacts used to test use  of DB2 in WPF';
ALTER TABLE "ADMINISTRATOR"."CONTACTS" 
  ADD CONSTRAINT "CONTACT_ID" PRIMARY KEY ("ID");
COMMIT;

-- Add contact records
INSERT INTO "ADMINISTRATOR"."CONTACTS" (FIRSTNAME, LASTNAME, ADDRESS, COMPANY, PHONE, EMAIL, FAX) VALUES
('Bob', 'Jones', '12 Elm St', 'Bobs Plumbing', '555-2323', 'bob@bobs_plumbing.com', '555-2333'),
('Sally', 'Williams', '23 Millewa Ave', 'Acme Co.', '747-7767', 'swilliams@acme.com', '747-7769'),
('James', 'Cummings', '46 Church Rd', 'Ties r Us', '555-1187', 'jcummings@tiesrus.com', '555-1180'),
('Haley', 'Smith', '46 Church Rd', 'Ties r Us', '555-1188', 'hsmith@tiesrus.com', '555-1180'),
('Patrick', 'Johnson', '23 Millewa Ave', 'Acme Co.', '747-7768', 'pjohnson@acme.com', '747-7769');

COMMIT;


TERMINATE;
