in reply to [OT] When coders don't see eye to eye

I see no reason for the two tables. I'd just store the extra info of the second table, in an additional column in the former table. It's just one column! And the relationship is one to one. (Well ok, you could add additional info, like timestamp of deletion and a reason.)

I think you underestimate the power of SQL to just show the content of the posts that were not deleted.

Even if you use 2 tables, the second table (the extra info for deleted posts) needs only contain the post_id and the additional info. Again, SQL can easily join the two tables into a single query (A left join to get all messages, an inner join for the deleted ones). If your database supports views (and I doubt MySQL does, at least the older versions don't), then you can create a view to hold the query, and access it as if it was a single table. Without views, you have to hardcode the join every time, which still isn't so bad.

The redundancy in your approaches are just a major sin against normalisation: you're storing the same info twice, and if something goes wrong, the message text in both versions don't even have to agree.

  • Comment on Re: [OT] When coders don't see eye to eye

Replies are listed 'Best First'.
Re^2: [OT] When coders don't see eye to eye
by Anonymous Monk on Oct 28, 2006 at 10:26 UTC

    Many thanks :)/p> Storing the extra info in an additional column in the posts table has the advantage that it's neater because everything is on that single table. But it incurs the cost of an extra not-so-useful column for every row in the table.