CREATE TABLE tags ( id integer NOT NULL PRIMARY KEY, name varchar(255) NOT NULL, description text ); CREATE TABLE files ( id integer NOT NULL PRIMARY KEY, -- TODO: just call this column 'name' -- This will make things much easier as 'name' is -- also used for the tag table. canonical_name varchar(255) NOT NULL, full_name varchar(255) NOT NULL, description text, date integer NOT NULL, sum integer NOT NULL, extension varchar(15) NOT NULL ); CREATE TABLE file_tags ( file integer NOT NULL, tag integer NOT NULL, FOREIGN KEY(file) REFERENCES files(id), FOREIGN KEY(tag) REFERENCES tags(id) );