insert into STUDENT select null, 1, REGISTRATION.NUMBER, PARTY.ID_INTERNAL
	from REGISTRATION inner join PARTY on PARTY.ID_INTERNAL = REGISTRATION.KEY_PERSON group by PARTY.ID_INTERNAL;

update STUDENT, REGISTRATION, PARTY set STUDENT.NUMBER = REGISTRATION.NUMBER, REGISTRATION.KEY_STUDENT = STUDENT.ID_INTERNAL
	where STUDENT.KEY_PERSON = PARTY.ID_INTERNAL and PARTY.ID_INTERNAL = REGISTRATION.KEY_PERSON;

update STUDENT, REGISTRATION, PARTY set STUDENT.NUMBER = REGISTRATION.NUMBER, REGISTRATION.KEY_STUDENT = STUDENT.ID_INTERNAL 
	where STUDENT.KEY_PERSON = PARTY.ID_INTERNAL and PARTY.ID_INTERNAL = REGISTRATION.KEY_PERSON
	and REGISTRATION.DEGREE_TYPE = 'MASTER_DEGREE';