Relational Model Fundamentals

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which concept is used extensively in mathematics to ascertain whether an assertion is true or false within the relational model?

  • Set theory
  • Predicate logic (correct)
  • Linear algebra
  • Calculus

In the context of relational databases, what does 'determination' signify?

  • The enforcement of integrity rules to ensure data consistency
  • The state in which knowing the value of one attribute makes it possible to determine the value of another. (correct)
  • The process of normalizing data to reduce redundancy
  • The act of defining relationships between entities in an ER diagram

What is the significance of functional dependence in a relational database?

  • It defines how users interact with the database.
  • It describes the physical storage of data.
  • It ensures each table has a primary key.
  • It means that the value of one or more attributes determines the value of one or more other attributes. (correct)

In database terminology, what is the term for an attribute whose value determines the value of another attribute?

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

Given the functional dependency STU_NUM -> STU_LNAME, which statement is correct?

<p>STU_NUM is the determinant, and STU_LNAME is the dependent. (D)</p> Signup and view all the answers

What distinguishes a composite key from other types of keys in a relational database?

<p>It is composed of more than one attribute. (D)</p> Signup and view all the answers

In the context of database keys, what is a 'superkey'?

<p>An attribute or combination of attributes that uniquely identifies any row in the table (A)</p> Signup and view all the answers

How does a 'candidate key' differ from a 'superkey'?

<p>A candidate key is a superkey without any unnecessary attributes. (D)</p> Signup and view all the answers

What is the primary criterion for selecting a 'primary key' from the candidate keys?

<p>The primary key must uniquely identify all other attribute values in any given row and cannot contain null entries. (D)</p> Signup and view all the answers

In the context of relational databases, what is a 'foreign key'?

<p>An attribute or combination of attributes in one table whose values must match the primary key in another table (B)</p> Signup and view all the answers

Which of the following best describes the purpose of 'secondary keys' in a database?

<p>To improve the speed and efficiency of data retrieval operations (A)</p> Signup and view all the answers

What does 'entity integrity' ensure in a relational database?

<p>That each row in a table has a unique identity (C)</p> Signup and view all the answers

What is the primary purpose of 'referential integrity' in a database system?

<p>To maintain the consistency of relationships between tables (D)</p> Signup and view all the answers

Why is it important for primary key entries to be unique and not null, according to 'entity integrity' rules?

<p>To ensure each row has a distinct identity and to avoid ambiguity in relationships (A)</p> Signup and view all the answers

In the context of 'referential integrity', what does it mean for a foreign key to have a null entry?

<p>It is permissible if the attribute is not part of the table's primary key and either matches a primary key value or is null. (A)</p> Signup and view all the answers

What is the result of applying relational algebra operators on existing relations (tables)?

<p>It produces new relations, a property known as closure. (C)</p> Signup and view all the answers

Two tables are considered 'union-compatible' if they meet which of the following criteria?

<p>They have the same number of columns and corresponding columns have compatible domains. (A)</p> Signup and view all the answers

In the context of relational algebra, what does the 'INTERSECT' operator do?

<p>It retrieves rows that are common to two union-compatible tables. (C)</p> Signup and view all the answers

What is the primary function of the 'JOIN' operator in relational algebra?

<p>To retrieve rows from two tables based on related columns (B)</p> Signup and view all the answers

In an Entity Relationship Diagram (ERD), how are entities represented?

<p>By rectangles (A)</p> Signup and view all the answers

Flashcards

Relational Model

Based on predicate logic and set theory, introduced by E. F. Codd in 1970.

Table (Relation)

A two-dimensional structure composed of rows (tuples) and columns (attributes).

Tuple (Row)

Represents data about an entity in a table.

Attribute (Column)

Represents a characteristic or property of an entity; each column has a distinct name.

Signup and view all the flashcards

Key

An attribute or group of attributes that uniquely identifies the values of other attributes in a table.

Signup and view all the flashcards

Determinant (Key)

An attribute whose value determines the value of another attribute.

Signup and view all the flashcards

Dependent

The attribute whose value is determined by the determinant.

Signup and view all the flashcards

Composite Key

A key composed of more than one attribute.

Signup and view all the flashcards

Candidate Key

Superkey without any unnecessary attributes.

Signup and view all the flashcards

Primary Key

A candidate key selected to uniquely identify all other attribute values in any given row; cannot contain null entries.

Signup and view all the flashcards

Foreign Key

An attribute in one table that references the primary key in another table.

Signup and view all the flashcards

Entity Integrity

A condition where each row in a table has a unique identity, ensured by a primary key.

Signup and view all the flashcards

Referential Integrity

The conditional rule where every reference to an entity instance by another entity instance is valid.

Signup and view all the flashcards

Unnormalized Data

Raw data in its original state, potentially containing redundancies.

Signup and view all the flashcards

Normalization

The process of organizing attributes to reduce data redundancies.

Signup and view all the flashcards

First Normal Form (1NF)

Ensures each row/column intersection contains only one value.

Signup and view all the flashcards

Second Normal Form (2NF)

Requires being in 1NF and all non-key attributes depend on the primary key.

Signup and view all the flashcards

Third Normal Form (3NF)

Requires being in 2NF with no non-key attribute determined by another non-key attribute.

Signup and view all the flashcards

Entity Relationship Model (ERM)

A data model describing relationships among entities at the conceptual level.

Signup and view all the flashcards

Entity Relationship Diagram (ERD)

A diagram depicting entities, attributes, and relationships in an ERM.

Signup and view all the flashcards

Study Notes

Fundamentals of Relational Model

  • The relational model is from 1970, by E. F. Codd.
  • It is based on predicate logic and set theory.
  • Predicate logic helps verify assertions in mathematics.
  • Set theory deals with sets, and is the basis for data manipulation.
  • Example: Sets A (15, 23, 52) and B (41, 52, 70, 12) share the value 52.
  • The relational model includes:
    • A logical data structure represented by relations
    • A set of integrity rules for data consistency
    • A set of operations for data manipulation

Tables and Relations

  • A table is a two-dimensional structure of rows and columns.
  • A table row (tuple) represents data about an entity.
  • A table column represents an attribute with a distinct name.
  • Each row and column intersection represents a single data value.
  • All column values must conform to the same data format.
  • Each column has an attribute domain, which is a range of values.
  • The order of rows and columns does not matter in a DBMS.
  • In a STUDENT table:
    • There are six rows/tuples and five columns/attributes.
    • Each row describes a student (e.g., row 5 describes Martin S. Cruz).
    • The STU_MI domain is characters A to Z.
    • STU_NUM is the primary key; while STU_LNAME is not.

Keys

  • A key is an attribute/group of attributes determining other attribute values.
  • Invoice number identifies invoice attributes.
  • Determination is knowing an attribute's value to find another's value.
  • Functional dependence means one or more attributes determines the value of others.
  • The determinant is the attribute whose value determines another.
  • The dependent is the attribute whose value is determined by the other.
  • Standard notation: ATT_A → ATT_B, e.g., STU_NUM → STU_LNAME.
  • STU_NUM is determinant, STU_LNAME is dependent.
  • Knowing STU_NUM determines STU_LNAME.
  • Functional dependence can involve a determinant that comprises multiple attributes.
  • Composite key: STU_NUM → (STU_LNAME, STU_FNAME, STU_MI, STU_SECT)
  • A key attribute is a part of a key.

Key Types

  • Superkey: An attribute/combination that uniquely identifies a table row.
    • Example: STU_NUM and any combination with STU_NUM
  • Candidate Key: A superkey without unnecessary attributes.
    • Example: STU_NUM
  • Primary Key: A candidate key to uniquely identify all attribute values, cannot contain null entries.
    • Example: STU_NUM
  • Foreign Key: An attribute or combination in one table that matches the primary key in another table (or is null).
    • Example: STU_SECT.
  • Secondary Key: An attribute or combination used for data retrieval.
    • Example: (STU_LNAME, STU_FNAME, STU_MI)

Integrity Rules

  • Entity integrity: Each table row has a unique identity.
  • Referential integrity: Every reference to an entity instance is valid.
  • Integrity rules are followed to maintain a good database design.

Entity Integrity

  • Requirement: Primary key entries are unique and not null.
  • Purpose: Each row has a unique identity and foreign key values can properly reference primary key values.
    • Example: Invoices must be uniquely identified by their invoice number.

Referential Integrity

  • Requirement: A foreign key can be null if it is not part of the table’s primary key, or matches the primary key value of a related table.
  • Every non-null foreign key value must reference an existing primary key value.
  • It is possible for an attribute not to have a corresponding value, but it will be impossible to have an invalid entry
  • Purpose: It is possible for an attribute not to have a corresponding value, but it will be impossible to have an invalid entry.
  • Enforcing referential integrity prevents deleting a row if its primary key corresponds to mandatory foreign key values in another table.
    • A customer might not have an assigned sales representative (number), but it will be impossible to have an invalid sales representative (number).

Real-World Referential Integrity

  • STUDENTS table contains STU_SECT, a foreign key linking to SECTIONS table entries.
  • STU_CODE row 324257 has a null STU_SECT (Marco Velasco unassigned).
  • Other STU_SECT entries in STUDENTS match entries in SECTIONS.
  • Flags (special codes) can indicate the absence of a value. Example: code NS. If used, the SECTIONS table must have a dummy row with STU_SECT value NS.

Relational Algebra

  • Data can be manipulated for useful information.
  • Relational algebra principles manipulating table contents.
  • Relational algebra operators on tables yields new relations (closure).
  • Condition evaluated is known as predicate.
  • There are eight fundamental relational operators:

Relational Algebra Operators

  • SELECT: Retrieves a subset of rows based on specified conditions.
    • Syntax: σ CONDITION (TABLE)
  • PROJECT: Retrieves a subset of columns.
    • Syntax: π COLUMNS (TABLE)
  • UNION: Merges union-compatible tables, removing duplicates.
  • INTERSECT: Retrieves common rows from two union-compatible tables.
    • Syntax: TABLE1 ∩ TABLE2
  • DIFFERENCE: Retrieves rows from one table not found in another union-compatible table.
    • Syntax: TABLE1 – TABLE2
  • PRODUCT: Retrieves pairs of rows from two tables (Cartesian product).
    • Syntax: TABLE1 x TABLE2
  • JOIN: Retrieves rows based on criteria (ex. common attribute values).
    • Syntax: TABLE1 ⨝ TABLE2
  • DIVIDE: Retrieves values.
    • Syntax: TABLE1 ÷ TABLE2

Studying That Suits You

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

Quiz Team

Related Documents

Use Quizgecko on...
Browser
Browser