0

enter image description here

I'm concerned that I have a data integrity issue involving the Versions and VersionQuestions tables. For example, if DefMasterID is changed in the Versions table, it will point to a different master definition, but the child records in Questions will still be pointing at records in the MasterQuestionsPool that belong to the original survey master. Ideally, the constraints would prevent this but I don't think they will.

Do I have integrity with this design? If not, what is the appropriate path to take to ensure integrity?

The above schema is based on these requirements:

  1. There need to be multiple survey master definitions that represent significantly different surveys.

  2. A master survey definition needs one or more versions, which represent small differences.

  3. Each survey master has a pool of questions, which are shared between its versions. An individual version generally will not use all questions. This provides the ability to compare answers across all versions of a survey master.

4

1 に答える 1

0

あなたが心配するのは正しいと思います。

1 つのアプローチは、識別子 (MasterQuestionInstanceLabel のようなものと呼びます) を、特定のプール内で一意の MasterQuestionsPool に追加することです (プール間である必要はありません)。つまり、マスター 1 との質問 1 の組み合わせは、質問 "A" (マスター 1 の場合) としてラベル付けされる可能性がありますが、マスター 2 には別の質問 "A" がある可能性があります。次に、MasterVersionQuestions テーブルで、実際の質問 ID ではなく、そのラベルを使用します。

これは現実に少しよく合っていると思います。アイデアは、特定のマスターに対して質問のプールを定義するというものです -- 質問 A、B、C、D、E、F (実際の ID 1、5、102、15、および 754 のラベルです)。バージョン 1 は A、B、および E を使用し、バージョン 2 は A、B、C、および F を使用するとします (バージョン テーブルの実際の ID を参照するのではなく)。

このように、バージョン テーブルは「どの質問がこのバージョンに含まれているか」を示しているのではなく、「どのマスターのプール インスタンスがこのバージョンに含まれているか」を示しています。

于 2012-10-24T19:18:59.880 に答える