alter table COMPETENCE_COURSE_INFORMATION drop column END_DATE_YEAR_MONTH_DAY;
alter table COMPETENCE_COURSE_INFORMATION add column KEY_EXECUTION_PERIOD int(11);
alter table COMPETENCE_COURSE_INFORMATION add INDEX (`KEY_EXECUTION_PERIOD`);

update COMPETENCE_COURSE_INFORMATION set KEY_EXECUTION_PERIOD = (SELECT ID_INTERNAL FROM EXECUTION_PERIOD WHERE NAME like '1 Semestre' AND KEY_EXECUTION_YEAR IN ( SELECT ID_INTERNAL FROM EXECUTION_YEAR WHERE YEAR='2006/2007'));

