It has been some time since I have last mucked around with databases, so that as usually my thoughts has ended up on which I have to do. Here's me problem:
- I've a listing of records (strings).
- Each entry features its own title and different ID.
- Records can share names, although not IDs.
- Records may also have qualities (strings).
- Records might have several of the identical property.
- Each property for every entry might have its very own value (string).
What is the best table layout for individuals needs?
Okay dumb question. Thanks anyway for that help. :P
Entry table, with Title and UniqueID (PK)
Property Table, with PropertyName and ID (PK)
EntryProperty Table with EntryID (FK), PropertyID (FK), UniqueID (PK), Value.
Well, the issue for me personally is foreseeing out how to deal with records getting multiple duplicate qualities. Will I produce a new table for every entry or what?
Well, no :-)
Presuming you possess an Entry and Property table, my prediction is you would want a table using the following posts:
id, entry_id, property_id, property_value, timestamp
Does which help or did I get all of it wrong?
CREATE TABLE entries ( INTEGER id NOT NULL AUTOINCREMENT, VARCHAR(XX) name, PRIMARY KEY(id) ) CREATE TABLE properties ( INTEGER id NOT NULL AUTOINCREMENT, VARCHAR(XX) name, VARCHAR(XX) value, INTEGER entryid NOT NULL, FOREIGN KEY(entryid) REFERENCES entries (id) )