alter table LESSON add column KEY_LESSON_SPACE_OCCUPATION int(11) default NULL;
alter table LESSON add key KEY_LESSON_SPACE_OCCUPATION (KEY_LESSON_SPACE_OCCUPATION);

alter table LESSON drop column KEY_ROOM_OCCUPATION;

select concat('update LESSON set LESSON.KEY_LESSON_SPACE_OCCUPATION = ' , RESOURCE_ALLOCATION.ID_INTERNAL , ' where LESSON.ID_INTERNAL = ' , RESOURCE_ALLOCATION.KEY_LESSON , ';') as "" from RESOURCE_ALLOCATION where RESOURCE_ALLOCATION.KEY_LESSON is not null;

alter table LESSON drop key U1;
alter table LESSON drop column KEY_SALA;