0

I am looking for an example of expressing a "Composite Keys" in a data dictionary.

I am using an MSO Access application with a Lecturer Table and Subjects Table where I have taken the Primary Keys from their tables to create a table called Timetable.

From the information building the database file I must create a Data Dictionary but was caught off guard when I had to question myself in explaining the referencing of these two fields that create them as a Composite Key.

My "Data Dictionary" is comprised of a Field Name, Data Type with Field Size, Constraints, References and Field Description.

I have found it difficult to find any subjects on this matter which is directed by how a Composite Key in a Data Dictionary may be expressed and hope I may get some ideas here.

1 Answer 1

1

Notation for composite keys typically takes the form of:

(key1, key2)

This can be seen in the T-SQL language, per:

CREATE TABLE dbo.lecturers
(
    lecturer_name varchar(30) NOT NULL
        PRIMARY KEY
);

CREATE TABLE dbo.subjects
(
    subject_name varchar(30) NOT NULL
        PRIMARY KEY
);

CREATE TABLE dbo.timetable
(
      lecturer_name varchar(30) NOT NULL
        FOREIGN KEY
        REFERENCES dbo.lecturers(lecturer_name)
    , subject_name varchar(30) NOT NULL
        FOREIGN KEY
        REFERENCES dbo.subjects(subject_name)
    , PRIMARY KEY (lecturer_name, subject_name)
);

In the above example, the composite primary key for dbo.timetable is expressed as (lecturer_name, subject_name).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.