-- if purchase table already exists, remove the table
if exists
    (select *
     from sysobjects
     where id = object_id(N'Purchase')
           and OBJECTPROPERTY(id, N'IsUserTable') = 1
    )
  drop table Purchase
GO

-- create a new empty table Purchase
CREATE TABLE Purchase 
(Customer CHAR(12),
 ItemBought CHAR(12) )
;

-- Add rows of data to Purchase table
INSERT INTO Purchase
VALUES
('Cindy','bread');

INSERT INTO Purchase
VALUES
('Cindy','cookies');

INSERT INTO Purchase
VALUES
('Cindy','juice');

INSERT INTO Purchase
VALUES
('Cindy','milk');

INSERT INTO Purchase
VALUES
('David','juice');

INSERT INTO Purchase
VALUES
('David','milk');

INSERT INTO Purchase
VALUES
('Grace','eggs');

INSERT INTO Purchase
VALUES
('Grace','milk');

INSERT INTO Purchase
VALUES
('Juan','bread');

INSERT INTO Purchase
VALUES
('Juan','coffee');

INSERT INTO Purchase
VALUES
('Juan','cookies');

