Database Normalization and Functional Dependencies

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

What is a requirement for a table to be in the Third Normal Form (3NF)?

  • It must not contain any non-prime attributes.
  • It must be in Second Normal Form (2NF). (correct)
  • It must have at least two candidate keys.
  • It must have a composite primary key.

Which of the following statements correctly describes transitive partial dependency?

  • It occurs when non-key attributes depend on another non-key attribute. (correct)
  • It is when all attributes are fully dependent on the primary key.
  • It signifies a one-to-many relationship between two tables.
  • It is a relationship where non-key attributes depend on only a part of a composite key.

In the context of normalization, what defines a prime attribute?

  • Any attribute that is not part of any candidate key.
  • An attribute that can exist independently of others.
  • An attribute that directly relates to the primary key.
  • An attribute that is part of any candidate key. (correct)

What is the primary goal of achieving Second Normal Form (2NF)?

<p>To ensure that all non-key attributes are fully functional dependent on the primary key. (D)</p> Signup and view all the answers

Which of the following could lead to a table violating the Second Normal Form (2NF)?

<p>An attribute that depends on only a part of the composite primary key. (B)</p> Signup and view all the answers

Which statement correctly defines a primary key?

<p>It uniquely identifies each record in a table. (A)</p> Signup and view all the answers

What is an example of a composite key?

<p>Two or more columns combined to form a unique identifier. (C)</p> Signup and view all the answers

Which statement about a foreign key is true?

<p>It establishes a link between two different tables. (D)</p> Signup and view all the answers

What type of dependency occurs when a non-primary attribute is defined by another non-primary attribute?

<p>Transitive Dependency (B)</p> Signup and view all the answers

Which of the following is NOT a characteristic of a primary key?

<p>They can link to other tables as foreign keys. (B)</p> Signup and view all the answers

In the context of relational databases, which statement about candidate keys is correct?

<p>Any candidate key can be composed of multiple columns. (D)</p> Signup and view all the answers

What does the term 'NULL values' imply in relation to primary keys?

<p>They prevent unique identification. (D)</p> Signup and view all the answers

How can multiple rows be uniquely identified using a composite key?

<p>By combining unique attributes from different columns. (A)</p> Signup and view all the answers

What does a functional dependency of the form X→Y signify in a database table?

<p>X is an attribute that determines Y's value (B)</p> Signup and view all the answers

In the context of database normalization, which of the following is NOT a purpose of functional dependencies?

<p>To increase data redundancy (A)</p> Signup and view all the answers

Which statement accurately describes full dependency in a database?

<p>All attributes of the primary key are needed to identify a non-primary attribute's value (B)</p> Signup and view all the answers

What is a characteristic of partial dependency in a database table?

<p>It can be resolved using normalization techniques (C)</p> Signup and view all the answers

Which statement is true regarding the primary key in a table with the attributes roll_no, name, and city?

<p>roll_no is the only unique attribute and serves as the primary key (B)</p> Signup and view all the answers

What does achieving a higher normal form, like BCNF, help prevent in a database?

<p>Data inconsistency and redundancy (A)</p> Signup and view all the answers

Which statement about a Super Key is true?

<p>A Super Key uniquely identifies all attributes in a relation. (D)</p> Signup and view all the answers

Which of the following is NOT a level of normalization typically referenced?

<p>Recursive Normal Form (RNF) (C)</p> Signup and view all the answers

What is the purpose of database normalization?

<p>To organize data in a consistent way. (C)</p> Signup and view all the answers

In which scenario would a database designer focus on achieving the Second Normal Form (2NF)?

<p>When partial dependencies are present with a composite key (B)</p> Signup and view all the answers

What criterion does a relation need to satisfy to be in Second Normal Form (2NF)?

<p>It must be in First Normal Form (1NF) and have no partial dependency. (D)</p> Signup and view all the answers

What defines a primary key in a relational database?

<p>An attribute that uniquely identifies a record in a table. (B)</p> Signup and view all the answers

Which of the following describes the First Normal Form (1NF)?

<p>It requires atomicity and a primary key. (D)</p> Signup and view all the answers

Which of the following forms is a prerequisite for a table to be in Third Normal Form (3NF)?

<p>The table must have been designed in 2NF. (B)</p> Signup and view all the answers

What typically results from effective database normalization?

<p>Improved data integrity. (D)</p> Signup and view all the answers

Which of the following statements correctly describes composite keys?

<p>Composite keys are used to identify records based on multiple attributes. (B)</p> Signup and view all the answers

Flashcards

Primary Key

A column(s) that uniquely identifies each row in a table. No NULL values allowed.

Composite Key

A primary key composed of two or more columns.

Foreign Key

A column in one table that references a primary key in another table, creating a link between tables.

Transitive Dependency

A non-primary attribute's value is determined by another non-primary attribute.

Signup and view all the flashcards

Candidate Key

A column or set of columns that could be a primary key, in a table. Unique values.

Signup and view all the flashcards

Functional Dependency

A relationship between attributes in a database table, where the value of one attribute determines the value of another.

Signup and view all the flashcards

Functional Dependency Example

In a table of employees, the department might determine the salary. Employees in the same department might have the same salary.

Signup and view all the flashcards

Primary Key

An attribute (or set of attributes) that uniquely identifies each record in a table.

Signup and view all the flashcards

Full Dependency (FD)

A functional dependency where all attributes of the primary key are necessary to determine the value of another attribute.

Signup and view all the flashcards

Partial Dependency

A non-primary attribute is dependent on only part of the primary key (composite key).

Signup and view all the flashcards

1NF

First Normal Form – every attribute in the table contains only atomic values; there are no repeating groups.

Signup and view all the flashcards

2NF

Second Normal Form - Meets 1NF and every non-key attribute is fully functionally dependent on the entire primary key.

Signup and view all the flashcards

3NF

Third Normal Form - Meets 2NF and does not have transitive dependencies. Meaning, no non-key attribute depends on another non-key attribute.

Signup and view all the flashcards

BCNF

Boyce-Codd Normal Form (3NF with additional rules): ensures that every determinant is a candidate key. Thus, no non-key attribute depends on any other non-key attribute.

Signup and view all the flashcards

Super Key

An attribute (or set of attributes) that uniquely identifies all attributes in a relation.

Signup and view all the flashcards

Candidate Key

A minimal superkey; a superkey from which no attribute can be removed without losing the uniqueness property.

Signup and view all the flashcards

Database Normalization

A database design principle for organizing data in a consistent and organized manner, minimizing redundancy and maintaining integrity.

Signup and view all the flashcards

1NF (First Normal Form)

A table is in 1NF if each cell contains only one value (atomic). It must have a primary key.

Signup and view all the flashcards

2NF (Second Normal Form)

A table is in 2NF if it's already in 1NF and all non-key attributes are fully dependent on the primary key (no partial dependencies).

Signup and view all the flashcards

Primary Key

An attribute (or set of attributes) that uniquely identifies each record (tuple) in a table (relation).

Signup and view all the flashcards

Partial Dependency

A non-key attribute depends on only part of the primary key, not the whole key.

Signup and view all the flashcards

2NF

A relational database design that is more organized than 1NF, removing redundant data and ensuring data integrity, by eliminating redundancy and ensuring attributes that are a complete part of the primary key.

Signup and view all the flashcards

3NF

A relational database design that eliminates transitive dependencies (non-key attributes dependent upon other non-key attributes) in 2NF tables ensuring data integrity and removes partial dependencies

Signup and view all the flashcards

Transitive Dependency

In a database table, a non-key attribute relying on another non-key attribute for its value.

Signup and view all the flashcards

Candidate Key

A column or set of columns in a table that could be a primary key. Uniquely identifies each row in a relational database table.

Signup and view all the flashcards

Prime attribute

An attribute present in at least one candidate key of a table.

Signup and view all the flashcards

Non-prime Attribute

Any attribute in a table that is not a part of a candidate key.

Signup and view all the flashcards

Study Notes

Database Normalization

  • Database normalization is a design principle for organizing data consistently and avoiding redundancy.
  • It improves data integrity and reduces undesirable effects of insertion, deletion, or updates.

Functional Dependencies

  • Functional dependency is a relationship between attribute sets in a table.
  • It describes how the value of one attribute determines another's value.
  • Represented as X → Y, where X and Y are attribute sets in a table.

Functional Dependencies Example

  • A table "Employees" with attributes (employee ID, name, department, salary).
  • "department → salary" means employees in the same department share the same salary.

Another Example

  • 'roll_no' is a unique identifier (primary key) for a student table.
  • 'name' and 'city' depend on 'roll_no'
  • 'name' and 'city' are functionally dependent on 'roll_no'.
  • You cannot get 'roll_no' based on 'name' or 'city' alone.

Why Functional Dependency Is Used?

  • Maintains data integrity
  • Facilitates easy data maintenance
  • Enables efficient data storage
  • Improves data redundancy

Types of Dependencies

  • Full Dependency: All primary key attributes are needed to determine a non-primary attribute. Example: To get a student's mark, both roll number and subject ID are needed.

  • Partial Dependency: Primary key is composed of multiple attributes; a non-key attribute depends on only part of the composite key. Example: In a student table, if we use roll number + subject ID, but a subject name only depends on the subject ID, then it's a partial dependency.

  • Transitive Dependency: The value of a non-primary attribute is determined by another non-primary attribute. Example: If 'city' is dependent on 'zip_code', which is also not a primary key, then there is transitive dependency.

Primary Key

  • Uniquely identifies each row in a table.
  • Cannot contain NULL values.
  • Example: 'STUD_NO' in a 'STUDENTS' table.

Foreign Key

  • A column or set of columns referencing a primary key in another table, creating a link between them.
  • Example: 'STUD_NO' in a 'STUDENT_COURSE' table references 'STUD_NO' in a 'STUDENT' table.

Composite Key

  • Combination of two or more columns uniquely identifying each row.
  • Example: 'STUD_NO' and 'PHONE' together uniquely define a student.

Super Key

  • An attribute (or set of attributes) uniquely defining all attributes in a relation.
  • It can include more than one candidate key.
  • Example: If 'ID' and ('First Name', 'Last Name') are both candidate keys in a 'STUDENT' table, both together are a super key.

Database Normalization

  • Database normalization is a database design principle for organizing data consistently to avoid complexities and redundancy.

Purpose of Normalization

  • To avoid complexities
  • To eliminate redundancy
  • To organize data consistently.
  • Primary, foreign, and composite keys support these relationships.

1NF, 2NF and 3NF

  • 1NF, 2NF and 3NF are the first three types of database normalization steps. They stand for first normal form, second normal form, and third normal form, respectively.
  • Other higher normal forms (4NF, 5NF) exist but are less commonly used by DB administrators
  • Subsequent normal forms build upon previous ones.

The First Normal Form - 1NF

  • A table is in 1NF if it meets atomicity (no single cell holds more than one value) and has a primary key for identification.

The Second Normal Form - 2NF

  • A table is in 2NF if it's already in 1NF, with no partial dependencies (non-key attributes depend on the entire primary key, not just part of it).

The Third Normal Form - 3NF

  • A table is in 3NF if it's in 2NF and has no transitive dependencies (non-key attributes don't depend on other non-key attributes).

BCNF (Boyce-Codd Normal Form)

  • A stronger form than 3NF: if a functional dependency X --> A exists, then X must be a superkey.
  • Each normal form builds on the previous one, with each new level being more strict.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Fundamentals of Databases
45 questions

Fundamentals of Databases

YouthfulTsavorite7659 avatar
YouthfulTsavorite7659
Database Normalization
40 questions

Database Normalization

DiligentSkunk285 avatar
DiligentSkunk285
Use Quizgecko on...
Browser
Browser