DBMS Keys: Super, Candidate, Primary
5 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

A university database contains student information, including student_id, email, and phone_number. All three can uniquely identify a student. If the database administrator chooses student_id as the primary key, what are email and phone_number considered?

  • Super Keys
  • Surrogate Keys
  • Foreign Keys
  • Alternate Keys (correct)

Consider two tables, Employees and Departments. The Employees table includes an employee_id (primary key), employee_name, and department_id. The Departments table has department_id (primary key) and department_name. How does department_id function in the Employees table?

  • Super Key
  • Primary Key
  • Foreign Key (correct)
  • Alternate Key

A table named Orders stores order information. It lacks a single attribute that can uniquely identify each order. Instead, the combination of order_date and order_time is used to ensure uniqueness. What type of key is (order_date, order_time) in this scenario?

  • Foreign Key
  • Composite Key (correct)
  • Super Key
  • Surrogate Key

A StudentCourses table uses both student_id and course_code to uniquely identify each record, and course_code is also a foreign key referencing the Courses table. What kind of key is the combination of student_id and course_code?

<p>Compound Key (B)</p> Signup and view all the answers

In a Products table, no existing attribute or combination of attributes can guarantee uniqueness across all records, so an auto_increment integer field called product_id is added. What type of key is product_id?

<p>Surrogate Key (C)</p> Signup and view all the answers

Flashcards

DBMS Key

Attribute(s) that uniquely identifies each record in a database table.

Super Key

A set of attributes that uniquely identifies records (rows).

Candidate Key

A minimal super key that uniquely identifies rows. No subset can also be a super key.

Primary Key

A candidate key chosen to uniquely identify each row in a table.

Signup and view all the flashcards

Foreign Key

Attribute in a table that references the primary key of another table.

Signup and view all the flashcards

Study Notes

DBMS Keys Overview

  • DBMS keys are attributes or sets of attributes that uniquely identify records (rows) in a database table.
  • Keys enable unique access to data rows.
  • They enforce data identity and integrity.
  • Keys establish relationships between tables.

Key Types

  • Super key
  • Candidate key
  • Primary key
  • Alternate key
  • Foreign key
  • Composite key
  • Compound key
  • Surrogate key

Super Key

  • A super key is a set of attributes that uniquely identifies records.
  • It is a superset containing all possible keys.
  • Examples: sID, registration ID, email, or any combination thereof.

Candidate Key

  • It is the minimal set of super keys that can uniquely identify rows.
  • No proper subset of a candidate key can also be a super key.
  • Examples: sID, email, and registration ID, when each can individually identify a row.

Primary Key

  • A primary key is a candidate key chosen to uniquely identify each row in a table.
  • Selection is often done by the database administrator based on usability.
  • Example: registration ID, as it is meaningful for college administration.

Alternate Key

  • Alternate keys are candidate keys that are not chosen as the primary key.

Foreign Key

  • A foreign key is an attribute in a table that establishes a relationship with another table.
  • It maintains data integrity across related tables.
  • Example: branch code in a students table referencing the branch table.
  • Databases often restrict modifications to columns used as foreign keys to maintain integrity.

Composite Key

  • A composite key consists of multiple attributes.
  • Any super key with more than one attribute is a composite key.
  • Examples: email + sID, sID + registration ID, registration ID + email.

Compound Key

  • compound key is a composite key containing at least one attribute which is a foreign key.

Surrogate Key

  • A surrogate key is created when a table lacks a natural primary key.
  • It serves the sole purpose of uniquely identifying rows without adding meaning to the data.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Overview of DBMS keys, including super key, candidate key and primary keys. Keys uniquely identify records and establish relationships between tables. Examples of keys are sID, registration ID and email.

More Like This

Use Quizgecko on...
Browser
Browser