Commit 85b105c2 authored by Richard's avatar Richard
Browse files

studentinfo changes

parent 3778f4db
......@@ -102,7 +102,29 @@ ALTER TABLE studentInfo ADD regionid int;
ALTER TABLE studentInfo ADD CONSTRAINT fk_regionid_studentInfo FOREIGN KEY (regionid) REFERENCES region (regionid);
UPDATE studentInfo JOIN region ON (studentInfo.region = region.name) SET studentInfo.regionid = region.regionid;
ALTER TABLE studentInfo DROP COLUMN region;
-- education to own table
CREATE TABLE education_level (
educationid int primary key AUTO_INCREMENT,
highest_level varchar(40)
);
INSERT INTO education_level (highest_level)
SELECT DISTINCT highest_education FROM studentInfo;
ALTER TABLE studentInfo ADD educationid int;
ALTER TABLE studentInfo ADD CONSTRAINT fk_educationid_studentInfo FOREIGN KEY (educationid) REFERENCES education_level (educationid);
UPDATE studentInfo JOIN education_level ON (studentInfo.highest_education = education_level.highest_level) SET studentInfo.educationid = education_level.educationid;
ALTER TABLE studentInfo DROP COLUMN highest_education;
-- gender to enum
ALTER TABLE studentInfo ADD gender_enum ENUM('M','F');
UPDATE studentInfo SET gender_enum = 'M' WHERE STRCMP(gender, 'M');
UPDATE studentInfo SET gender_enum = 'F' WHERE STRCMP(gender, 'F');
ALTER TABLE studentInfo DROP COLUMN gender;
ALTER TABLE studentInfo RENAME COLUMN gender_enum TO gender;
-- ===== studentAssessment Changes ===== --
-- new failed boolean column
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment