CREATE TABLE `items` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(80) NOT NULL,
  `description` text NOT NULL,
  `price` decimal(8,2) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `purchases` (
  `id` int(11) NOT NULL auto_increment,
  `item_id` int(11) NOT NULL,
  `quantity` int(11) NOT NULL default '0',
  `price` decimal(8,2) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `purchases_items` (`item_id`),
  CONSTRAINT `purchases_items` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

