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

In the context of relational databases, what is the primary function of predicate logic?

  • To ensure data consistency over time.
  • To provide a framework for verifying statements of fact as true or false. (correct)
  • To define the physical storage structure of data.
  • To manipulate sets of data using mathematical operations.

Which component is NOT a part of the relational model?

  • A set of operations that defines how data is manipulated
  • A set of integrity rules.
  • A set of procedural operations that directly modify data storage. (correct)
  • A logical data structure represented by relations.

What does the term 'attribute domain' refer to in the context of a relational database?

  • The unique identifier for each row in a table.
  • The method of data manipulation within a table.
  • The specific range of values allowed for each column. (correct)
  • The physical location where the database is stored.

Why is STU_NUM a better choice for a primary key than STU_LNAME in a student database?

<p>STU_NUM is guaranteed to be unique for each student. (D)</p> Signup and view all the answers

What does 'determination' mean in the context of database keys?

<p>Knowing the value of one attribute makes it possible to determine the value of another. (C)</p> Signup and view all the answers

Given the functional dependency STU_NUM → (STU_LNAME, STU_FNAME, STU_MI, STU_SECT), what does this indicate?

<p>Knowing STU_NUM allows you to determine STU_LNAME, STU_FNAME, STU_MI, and STU_SECT (D)</p> Signup and view all the answers

What is a 'composite key' in database terminology?

<p>A key that is made up of more than one attribute. (B)</p> Signup and view all the answers

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

<p>A superkey may contain unnecessary attributes, while a candidate key does not. (A)</p> Signup and view all the answers

What is the primary role of a 'foreign key' in a relational database?

<p>To establish a link between two tables. (A)</p> Signup and view all the answers

What is the entity integrity rule in relational databases?

<p>Each row in a table must have a unique identity, and no part of a primary key may be null. (D)</p> Signup and view all the answers

What does referential integrity ensure in the context of relational databases?

<p>Every foreign key value must reference an existing primary key value. (D)</p> Signup and view all the answers

In the context of integrity rules, what is the significance of allowing a foreign key to have a NULL entry?

<p>It indicates that the related entity instance does not yet exist or is unknown. (D)</p> Signup and view all the answers

What is the purpose of using 'flags' in database design, as mentioned in the text?

<p>To indicate the absence of some value, avoiding the use of NULL. (B)</p> Signup and view all the answers

What is the significance of 'closure' in relational algebra?

<p>It means that applying relational algebra operators on existing relations produces new relations. (D)</p> Signup and view all the answers

Among the fundamental relational algebra operations, which one is used to retrieve a subset of columns from a table?

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

What is the purpose of the SELECT relational algebra operator?

<p>To retrieve rows that satisfy a given condition. (D)</p> Signup and view all the answers

Which relational algebra operation combines the rows from two tables into a new table, removing any duplicate rows??

<p>UNION (D)</p> Signup and view all the answers

What does the PRODUCT operation (Cartesian Product) do in relational algebra?

<p>It combines each row of one table with each row of another table. (A)</p> Signup and view all the answers

What is the main purpose of the JOIN operation in relational algebra?

<p>To retrieve rows from two tables based on a common attribute. (D)</p> Signup and view all the answers

What does it mean for two tables to be 'union-compatible'?

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

Flashcards

Table (Relation)

A two-dimensional structure composed of rows and columns. Each row represents data about an entity and each column represents an attribute.

Key

An attribute or group of attributes that determines the values of other attributes.

Determination

The state in which knowing the value of one attribute makes it possible to determine the value of another.

Functional Dependence

The value of one or more attributes determines the value of one or more other attributes.

Signup and view all the flashcards

Determinant (Key)

The attribute whose value determines another.

Signup and view all the flashcards

Dependent

The attribute whose value is determined by the other attribute.

Signup and view all the flashcards

Composite Key

A key that is composed of more than one attribute.

Signup and view all the flashcards

Key Attribute

An attribute that is part of a key.

Signup and view all the flashcards

Superkey

An attribute or combination of attributes that uniquely identifies any row in the table.

Signup and view all the flashcards

Candidate Key

A 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 or combination of attributes in one table whose values must either match the primary key in another table or be null.

Signup and view all the flashcards

Secondary Key

An attribute or combination of attributes used strictly for data retrieval purposes.

Signup and view all the flashcards

Entity Integrity

The condition in which each row in a table has its own unique identity.

Signup and view all the flashcards

Referential Integrity

The conditional in which every reference to an entity instance by another entity instance is valid.

Signup and view all the flashcards

Relational Algebra

A set of mathematical principles that form the basis for manipulating relational table contents.

Signup and view all the flashcards

Union-Compatible

Two or more tables that have the same number of columns and the corresponding columns have compatible domains.

Signup and view all the flashcards

SELECT (Relational Algebra)

Retrieves a subset of rows.

Signup and view all the flashcards

PROJECT (Relational Algebra)

Retrieves a subset of columns.

Signup and view all the flashcards

UNION (Relational algebra)

Merges two union-compatible tables into a new table, dropping the duplicate rows.

Signup and view all the flashcards

Study Notes

  • The relational model, introduced in 1970 by E. F. Codd, is based on predicate logic and set theory.

Fundamentals

  • Predicate logic provides a framework to verify assertions (statements of fact) as true or false; for example, a student with ID 324452 is Mark Reyes.
  • Set theory deals with sets or groups and is the basis for data manipulation; for example, sets A (15, 23, 52) and B (41, 52, 70, 12) share the value 52.
  • The relational model has three components: a logical data structure (relations), integrity rules, and a set of operations.
  • A table (relation) is a two-dimensional structure of rows and columns.
  • Each table row (tuple) represents data about an entity.
  • Each table column represents an attribute with a distinct name.
  • Each row and column intersection represents a single data value.
  • Column values must conform to the same data format, with a specific range known as the attribute domain.
  • The order of rows and columns is not important in a DBMS.

Student Table Conclusions

  • The STUDENT table is composed of six rows/tuples and five columns/attributes.
  • Each row describes a student; for example, row 5 describes Martin S. Cruz.
  • STU_MI values are limited to characters A to Z, representing the domain [A, Z].
  • STU_NUM is the primary key, guaranteed unique for each student.
  • STU_LNAME is not a good primary key because students can share the same last name.

Keys

  • A key is an attribute or group determining other attribute values; an invoice number identifies invoice attributes like date and customer name.
  • Determination is when an attribute's value makes it possible to determine another's value, based on relationships among attributes.
  • Functional dependence means one or more attributes' values determine others' values.
  • The determinant or key is the attribute whose value determines another attribute, called the dependent.
  • Standard notation for representing relationships between attributes is ATT_A → ATT_B; for example, STU_NUM → STU_LNAME.
  • STU_NUM is the determinant, and STU_LNAME is the dependent; a STU_NUM value determines the STU_LNAME since only one value is associated with any given STU_NUM.
  • Functional dependence can involve a determinant that comprises multiple attributes, example STU_NUM → (STU_LNAME, STU_FNAME, STU_MI, STU_SECT).
  • A composite key is composed of more than one attribute.
  • A key attribute is part of a key.

Key Types

  • A superkey uniquely identifies rows; such as STU_NUM, or (STU_NUM, STU_LNAME).
  • A candidate key is a superkey without unnecessary attributes; STU_NUM.
  • A primary key is a candidate key to uniquely identify all attribute values in a row and cannot contain null entries; STU_NUM.
  • A foreign key matches the primary key in another table or can be null; STU_SECT can be a foreign key if used as a primary key of another table.
  • A secondary key is used strictly for data retrieval; such as (STU_LNAME, STU_FNAME, STU_MI).

Integrity Rules

  • Entity integrity is when each table row has a unique identity.
  • Referential integrity is when every reference to an entity instance by another entity instance is valid.
  • Integrity rules are followed to maintain database design.

Entity Integrity

  • Requirement: Primary key entries are unique and non-null.
  • Purpose: Rows have unique identity, and foreign keys properly reference primary key values.
  • Example: An invoice has a unique non-null number.

Referential Integrity

  • Requirement: Foreign keys may be null as long as they are not part of the table's primary key, or an entry that matches the related table's primary key.
  • Every non-null foreign key value must reference an existing primary key value.
  • It is possible for an attribute to not have a value but impossible to have an invalid entry.
  • The enforcement of referential integrity prevents deleting a row with mandatory matching foreign key values in another table.
  • A customer might not yet have assigned sales representative number, but it will be impossible to have an invalid representative number.

Table Features

  • Entity Integrity: The STUDENTS primary key (STU_NUM) column has no null entries, and all entries are unique.
  • The SECTIONS table's primary key is STU_SECT, this column is also free of null entries.
  • Referential Integrity: The STUDENTS table contains a foreign key, STU_SECT, that links entries in it to entries in the SECTIONS table.
  • To avoid null values, special codes called flags are used, such as NS in the STU_SECT entry, to indicate that Marco Velasco's section does not yet have an assigned code.

Relational Algebra

  • Data can be manipulated to generate useful information.
  • Relational algebra manipulates relation contents, and when used on existing relations (tables) produce new relations called closure.
  • The condition to be evaluated is also known as predicate.
  • The eight fundamental relational operators are SELECT, PROJECT, UNION, INTERSECT, DIFFERENCE, PRODUCT, JOIN, DIVIDE.

Relational Algebra Operators

  • SELECT retrieves a subset of rows: σ CONDITION (TABLE).
  • PROJECT retrieves a subset of columns: π COLUMNS (TABLE).
  • UNION merges union-compatible tables, dropping duplicate rows: TABLE1 ∪ TABLE2
  • INTERSECT returns rows common to two union-compatible tables: TABLE1 ∩ TABLE2.
  • DIFFERENCE retrieves rows not found in another union-compatible table: TABLE1 – TABLE2.
  • PRODUCT retrieves possible row pairs; Cartesian Product: TABLE1 x TABLE2.
  • JOIN retrieves rows based on criteria: TABLE1 ⨝ TABLE2.
  • DIVIDE retrieves values: TABLE1 ÷ TABLE2.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Relational Model in Data Management
14 questions
CPT103 Introduction to Database
33 questions
Relational Model Overview
28 questions
Database Design and Relational Model
24 questions
Use Quizgecko on...
Browser
Browser