which design better when use foreign key instead of a string to store a list of id Possible Duplicate:
  Is using multiple foreign keys seperated by commas wrong, and if so, why?  




I'm building online examination system. I have designed to table, Question and GeneralExam. The table GeneralExam contains info about the exam like name, description, duration,... Now I would like to design table GeneralQuestion, it will contains the id of questions belongs to a general exam.

Currently, I have two idea to design GeneralQuestion table:


It will have two column: general_exam_id, question_id.
It will have two column: general_exam_id, list_question_ids(string/text).


So, I would like to know which designing is better, or Pros and Cons of each designing. I'm using Postgresql database.
As ypercube and marc_s pointed out, it's best to have a 2-column "mapping" table to store which questions are used by which general exams.

This approach provides the following benefits:


Foreign Keys can then be used to ensure data integrity
Queries are much easier to write (eg: find all general exams that use question 17)
Extending the database schema at a later date (to support new features) will be much easier
The schema will be easier to understand by new/other developers/DBAs since it confirms to best practice