On 25 Nov 2015, at 2:23pm, Domingo Alvarez Duarte <sqlite-mail at dev.dadbiz.es> wrote:
> This way we repeat the string everywhere then it's not DRY ! You know, I think you're the first person to mention DRY here. I had to look it up. <https://en.wikipedia.org/wiki/Don%27t_repeat_yourself> For some reason it seems that under DRY repeating a string in lots of places is bad, but repeating a number in lots of places is good. I'm not sure about the logic behind that. Okay, do this instead: CREATE TABLE enum_type (the_ID INTEGER PRIMARY KEY, the_value TEXT UNIQUE); INSERT INTO enum_type (the_value) VALUES ('simple'), ('tuple'); CREATE TABLE use_mytype (... ... one_type TEXT REFERENCES enum_type(theID) DEFAULT 2 ) It is now harder to know which value to insert for one_type. Simon.