There are two ways you can improve the structure of your database. The first one is simpler but the second one is more strict and completely normalized:
Way 1
Create an illness table:
CREATE TABLE illness(
id INTEGER NOT NULL AUTO_INCREMENT,
illnessName VARCHAR(255) UNIQUE NOT NULL,
PRIMARY KEY(illnessId)
);
Then create a table that uses each ilness' unique id to match it with its symptoms in a 1:n relationship.
CREATE TABLE illness_symptom(
illnessId INTEGER NOT NULL,
symptom VARCHAR(255),
FOREIGN KEY (illnessId) REFERENCES illness(id)ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY(illnessId, symptom)
);
The dual primary key ensures that no symptom is included twice for the same illness.
The fact that the symptom is a string makes it less strict than the following method which is the best:
WAY 2
The illness
table remains the same as in way 1:
CREATE TABLE illness(
id INTEGER NOT NULL AUTO_INCREMENT,
illnessName VARCHAR(255) UNIQUE NOT NULL,
PRIMARY KEY(illnessId)
);
Create a whole separate table for storing every possible symptom:
CREATE TABLE symptom(
id INTEGER NOT NULL AUTO_INCREMENT,
symptomName VARCHAR(255) UNIQUE NOT NULL,
PRIMARY KEY(id)
);
The create a third table that matches the id of the illness with the id of the symptom:
CREATE TABLE illness_symptom(
illnessId INTEGER NOT NULL,
symptomId INTEGER NOT NULL,
PRIMARY KEY(illnessId, symptomId),
FOREIGN KEY(illnessId) REFERENCES illness(id),
FOREIGN KEY(symptomId) REFERENCES symptom(id)
);
Again the dual primary key ensures that an illness does not include the same symptom more than once
EDIT
After creating the tables you can join them to get match each illness with its symptoms like this:
SELECT i.id, i.illnessName AS illnessName, s.symptomName AS symptomName
FROM (illness AS i JOIN illness_symptom AS is ON i.id=is.illnessId) JOIN symptom AS s ON is.symptomId=s.id
GROUP BY i.id;
An example output would something like this:
1 | Bronchitis | stuffiness
1 | Bronchitis | fatigue
1 | Bronchitis | thightness in the chest
2 | Whiplash | headache
2 | Whiplash | dizzyness
2 | Whiplash | concentration problems
You can read more about inner join here