{"Allergy_Type": {"columns": [[0, "Allergy", "VARCHAR(20)", 0, null, 1], [1, "AllergyType", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["Allergy"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Allergy"]]], "check_constraints": []}, "Has_Allergy": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "Allergy", "VARCHAR(20)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Allergy_Type", "Allergy", "Allergy", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "StuID", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Allergy_Type (
    Allergy VARCHAR(20)   PRIMARY KEY,
    AllergyType VARCHAR(20),
    UNIQUE (Allergy)
);

CREATE TABLE Has_Allergy (
    StuID INTEGER,
    Allergy VARCHAR(20),
    FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),
    FOREIGN KEY (StuID) REFERENCES Student(StuID)
);

CREATE TABLE Student (
    StuID INTEGER   PRIMARY KEY,
    LName VARCHAR(12),
    Fname VARCHAR(12),
    Age INTEGER,
    Sex VARCHAR(1),
    Major INTEGER,
    Advisor INTEGER,
    city_code VARCHAR(3)
);