I have a table:
CREATE TABLE pupils (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name TEXT, surname TEXT, address TEXT, score INTEGER
);
where score
is a percentage.
Is it more efficient to have the integer value in there or a foreign key to a table that is just a table like this?
CREATE TABLE score (percentage INTEGER PRIMARY KEY NOT NULL);
Obviously the table would be populated with 0-100.
My thoughts were if you have 1000's of pupils that keeping it as an integer column would mean queries were faster, but more space used and using the foreign key would mean less space used, but slower queries.
Not sure if this is correct?
So I thought I would throw it out there!