
CREATE TABLE `STUDENT_DATA_BY_EXECUTION_YEAR` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `KEY_STUDENT` int(11) NULL,
  `KEY_EXECUTION_YEAR` int(11) NOT NULL,
  `KEY_RESIDENCE_CANDIDACY` int(11),
  `WORKING_STUDENT` tinyint(1) NOT NULL default '0',
  `PERSONAL_DATA_AUTHORIZATION` varchar(50),
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`),
  KEY `KEY_STUDENT` (`KEY_STUDENT`),
  KEY `KEY_EXECUTION_YEAR` (`KEY_EXECUTION_YEAR`),
  KEY `KEY_RESIDENCE_CANDIDACY` (`KEY_RESIDENCE_CANDIDACY`),
  KEY `KEY_ROOT_DOMAIN_OBJECT` (`KEY_ROOT_DOMAIN_OBJECT`)
) ENGINE=InnoDB;


alter table RESIDENCE_CANDIDACIES add column KEY_STUDENT_DATA_BY_EXECUTION_YEAR int(11);

alter table RESIDENCE_CANDIDACIES change column KEY_STUDENT KEY_STUDENT int(11);

drop table REGISTRATION_DATA_BY_PERIOD;