Database Relations, Keys, and Referential Integrity

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/32

flashcard set

Earn XP

Description and Tags

Question-and-answer flashcards covering attributes, primary keys, composite keys, foreign keys, multivalued attributes, relation properties, and referential integrity examples.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

33 Terms

1
New cards

What are the attributes in the STUDENT relation?

StudentID, Name, Major, GPA

2
New cards

What are the rows (tuples) in the STUDENT relation?

(101, Alice, ComputerSci, 3.8), (102, Bob, Math, 3.5), (103, Charlie, Physics, 3.9)

3
New cards

Which attribute uniquely identifies each row in the STUDENT relation?

StudentID

4
New cards

Which attribute should be chosen as the primary key for STUDENT?

StudentID

5
New cards

In COURSE_ENROLLMENT, which attribute set uniquely identifies each row?

{StudentID, CourseID}

6
New cards

In COURSE_ENROLLMENT, which attribute set is NOT a candidate for a composite key?

{StudentID, EnrollmentDate}

7
New cards

Why is the combination of StudentID and CourseID considered a composite key in COURSE_ENROLLMENT?

Because the combination uniquely identifies each enrollment record

8
New cards

Which attribute in COURSE_ENROLLMENT is a foreign key referencing STUDENT?

StudentID

9
New cards

Which attribute in STUDENT is referenced by the foreign key in COURSE_ENROLLMENT?

StudentID

10
New cards

Is the table with duplicate StudentID rows a valid relation? Why or why not?

No, because the rows are not unique

11
New cards

What property of relations is violated when duplicate rows exist?

Each row must be unique

12
New cards

In the employee-training table, which attribute is multivalued?

CourseTitle

13
New cards

After identifying a multivalued attribute, what is the next step to create a valid relation?

Ensure each row contains a single value for each attribute

14
New cards

Is the employee-training table already a valid relation?

Yes

15
New cards

What is the primary key of the BOOK relation?

BookID

16
New cards

What is the primary key of the PUBLISHER relation?

PublisherID

17
New cards

What is the primary key of the CUSTOMER relation?

CustomerID

18
New cards

What is the primary key of the PURCHASE relation?

PurchaseID

19
New cards

Which attribute in BOOK is a foreign key referencing PUBLISHER?

PublisherID

20
New cards

In PURCHASE, which attribute is a foreign key referencing CUSTOMER?

CustomerID

21
New cards

In PURCHASE, which attribute is a foreign key referencing BOOK?

BookID

22
New cards

What is the primary key of STUDENT(StudentID, Name, MajorID)?

StudentID

23
New cards

What is the primary key of MAJOR(MajorID, MajorName)?

MajorID

24
New cards

What is the primary key of COURSE(CourseID, CourseName, MajorID)?

CourseID

25
New cards

What is the primary key of ENROLLMENT(StudentID, CourseID, Grade)?

Composite key (StudentID, CourseID)

26
New cards

Which attribute is a foreign key in STUDENT(StudentID, Name, MajorID)?

MajorID

27
New cards

Which attribute is a foreign key in COURSE(CourseID, CourseName, MajorID)?

MajorID

28
New cards

Why is a composite key used in a relation?

Because a single attribute is not sufficient to uniquely identify a record

29
New cards

Which OrderID has a CustomerID that does not exist in CUSTOMER?

OrderID 103

30
New cards

Which ORDER LINE row is valid (example 1)?

(101, 202, 1)

31
New cards

Which ORDER LINE row is valid (example 2)?

(102, 203, 1)

32
New cards

Which ORDER LINE row is valid (example 3)?

(103, 201, 5)

33
New cards

Which ORDER LINE row is valid (example 4)?

(106, 202, 2)