15
The best thing is a link table as you mentioned, but other solutions exists. Two come to mind:
- in the listings table you could change the link to the categories table from an 'int' to long string (varchar) and have the convention that this field contains a comma separated list of category ids, this could lead to very slow queries (and you do have to rewrite them); also there is a limitation on the number of categories (dictated by the length of the field) but it is quite large
- if you can live with a small maximum number of categories per listing (like 3 or 4) then you can add a few more 'int' fields that are links to categores; queries must be modified again
Since in both cases you have to modify queries anyhow you may just as well do the right thing and create a link table.
The problem is that you want to limit the number of categories anyhow in the GUI to prevent spaming.
Marius