   ADD KEY `drug_id` (`drug_id`);
 
 --
+-- Indexes for table `contracts_initialized_in_2016`
+--
+ALTER TABLE `contracts_initialized_in_2016`
+  ADD PRIMARY KEY (`pharmacy_id`,`pharmaceutical_company_id`),
+  ADD KEY `drug_id` (`drug_id`);
+
+--
+-- Indexes for table `contracts_terminated_in_2016`
+--
+ALTER TABLE `contracts_terminated_in_2016`
+  ADD PRIMARY KEY (`pharmacy_id`,`pharmaceutical_company_id`),
+  ADD KEY `drug_id` (`drug_id`);
+
+--
 -- Indexes for table `doctor`
 --
 ALTER TABLE `doctor`


CREATE ALGORITHM=UNDEFINED DEFINER=`admin`@`localhost` SQL SECURITY DEFINER VIEW `contracts_terminated_in_2016` AS select `contract`.`pharmacy_id` AS `pharmacy_id`,`contract`.`pharmaceutical_company_id` AS `pharmaceutical_company_id`,`contract`.`text` AS `text`,`contract`.`supervisor` AS `supervisor`,`contract`.`end_date` AS `end_date` from `contract` where (`contract`.`end_date` between '2016-01-01' and '2016-12-31');

  -- --------------------------------------------------------
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

  `text` varchar(50) NOT NULL,
  `supervisor` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Stand-in structure for view `contracts_initialized_in_2016`
--
CREATE TABLE IF NOT EXISTS `contracts_initialized_in_2016` (
    `pharmacy_id` int(11) NOT NULL,
    `pharmaceutical_company_id` int(11) NOT NULL,
    `drug_id` int(11) NOT NULL,
    `text` varchar(50) NOT NULL,
    `supervisor` varchar(20) NOT NULL,
    `start_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Stand-in structure for view `contracts_initialized_in_2016`
--
CREATE TABLE IF NOT EXISTS `contracts_terminated_in_2016` (
    `pharmacy_id` int(11) NOT NULL,
    `pharmaceutical_company_id` int(11) NOT NULL,
    `drug_id` int(11) NOT NULL,
    `text` varchar(50) NOT NULL,
    `supervisor` varchar(20) NOT NULL,
    `end_date` date NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

