In a StackOverflow clone, what relationship should a Comments table have to Questions and Answers?
问题 In an application similar to StackOverflow that I am building, I am trying to decide what relationship my Questions , Answers and Comments tables should have. I could have Questions and Answers both be represented by a single table Posts . That would allow Comments to have a single foreign key to Posts . But if Questions and Answers are separate tables, what relationships should Comments have to each of these? UPDATE: Although the chosen answer recommends a Class Table Inheritance approach