Relational Data Model

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 relational model, how is data represented?

Data is represented as a collection of relations (tables).

What is another term for a row in a relation?

Tuple

What does a tuple typically correspond to?

A real-world entity or relationship.

What is another term for a column name in a relation?

<p>Attribute</p>
Signup and view all the answers

What is a Domain D in the context of relational models?

<p>A set of atomic values.</p>
Signup and view all the answers

Specifying a domain involves defining the _____ _____ for that domain.

<p>data type</p>
Signup and view all the answers

What does a relation schema R define?

<p>It is denoted by R(A1, A2, ..., An) and consists of a relation name R and a list of attributes (A1, A2, ..., An).</p>
Signup and view all the answers

What is the degree (or arity) of a relation?

<p>The number of attributes (n) in its relation schema.</p>
Signup and view all the answers

What is a relation state, r(R)?

<p>A set of n-tuples r = {t1, t2, ..., tm}, where each tuple is an ordered list of values corresponding to the attributes in the schema R.</p>
Signup and view all the answers

Mathematically, how is a relation state r(R) defined in terms of domains?

<p>It is a subset of the Cartesian product of the domains of its attributes: r(R) ⊆ (dom(A1) × dom(A2) × ... × dom(An)).</p>
Signup and view all the answers

The order of tuples (rows) within a relation is important and affects its definition.

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

In the formal relational model, the order of attributes (columns) within a relation schema is critically important.

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

The basic relational model allows composite and multivalued attributes directly within a single tuple.

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

How must multivalued attributes be represented in the relational model?

<p>By separate relations.</p>
Signup and view all the answers

What are three possible meanings for a NULL value in a tuple?

<ol> <li>Value unknown (exists but is not known). 2. Value exists but is not available. 3. Attribute does not apply to this tuple (value undefined).</li> </ol>
Signup and view all the answers

In relational model notation, uppercase letters like Q, R, S typically denote _____ _____, while lowercase letters like q, r, s denote _____ _____.

<p>relation names, relation states</p>
Signup and view all the answers

How can an attribute A be qualified to specify which relation schema R it belongs to?

<p>Using dot notation: R.A</p>
Signup and view all the answers

What are constraints in the relational model?

<p>Restrictions on the actual values allowed in a database state, derived from real-world rules.</p>
Signup and view all the answers

Which of the following are common categories of constraints in the relational model?

<p>All of the above (E)</p>
Signup and view all the answers

What do Domain Constraints typically specify?

<p>The data type and format allowed for an attribute's values (e.g., numeric types, characters, booleans, strings, dates).</p>
Signup and view all the answers

What is a Superkey (SK) of a relation R?

<p>A set of attributes such that no two distinct tuples in any state r of R can have the same combination of values for these attributes.</p>
Signup and view all the answers

What is a Key (K) of a relation R?

<p>A minimal superkey; it's a superkey where removing any single attribute from K results in a set of attributes that is no longer a superkey.</p>
Signup and view all the answers

A relation schema can only have one key.

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

What is a Candidate Key?

<p>Any attribute or set of attributes that qualifies as a key for a relation schema.</p>
Signup and view all the answers

What is the Primary Key of a relation?

<p>One of the candidate keys selected by the database designer as the primary means of uniquely identifying tuples. It is often underlined in schema diagrams.</p>
Signup and view all the answers

What does the Entity Integrity constraint state?

<p>No primary key value can be NULL.</p>
Signup and view all the answers

What does the Referential Integrity constraint maintain?

<p>Consistency among tuples in two relations, typically specified between a foreign key and a primary key.</p>
Signup and view all the answers

What are the two main conditions for a set of attributes FK in relation R1 to be a Foreign Key referencing the primary key PK of relation R2?

<ol> <li>The attributes in FK must have the same domain(s) as the attributes in PK. 2. The value of FK in any tuple t1 of R1 must either match the value of PK for some tuple t2 in R2, or the value of FK must be NULL.</li> </ol>
Signup and view all the answers

What is a Functional Dependency constraint?

<p>A constraint between two sets of attributes, X and Y, stating that the value of X determines a unique value for Y (X → Y).</p>
Signup and view all the answers

What are the three basic update operations that can change the state of relations?

<p>Insert, Delete, Update (or Modify)</p>
Signup and view all the answers

What is a Relational Database Schema S?

<p>A set of relation schemas S = {R1, R2, ..., Rm} and a set of integrity constraints IC.</p>
Signup and view all the answers

What constitutes a valid state of a relational database?

<p>A set of relation states DB = {r1, r2, ..., rm} such that all relation states satisfy the integrity constraints specified in the database schema's IC.</p>
Signup and view all the answers

The Insert operation can potentially violate domain, key, entity integrity, and referential integrity constraints.

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

Which integrity constraint is primarily violated by the Delete operation?

<p>Referential integrity constraint.</p>
Signup and view all the answers

If deleting a tuple violates referential integrity because other tuples reference it, what are possible actions the system can take?

<p>All of the above (D)</p>
Signup and view all the answers

Updating an attribute that is neither a primary key nor a foreign key usually causes constraint violation problems.

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

What issues might arise when updating a primary key or a foreign key value?

<p>Similar issues as with Insert and Delete operations, potentially violating key, entity integrity, or referential integrity constraints.</p>
Signup and view all the answers

What is a Transaction in the context of databases?

<p>An executing program or process that includes one or more database operations (retrievals, insertions, deletions, updates) and must leave the database in a valid or consistent state.</p>
Signup and view all the answers

What does OLTP stand for?

<p>Online Transaction Processing</p>
Signup and view all the answers

Flashcards

Relational Model

Data represented as a collection of relations (tables).

Domain

A set of atomic values.

Relation schema R

Denoted by R(A1, A2, ..., An). Made up of a relation name R and a list of attributes.

Attribute A

The name of a role played by some domain D in the relation schema R.

Signup and view all the flashcards

Degree (or arity)

The number of attributes n of its relation schema.

Signup and view all the flashcards

Relation (or relation state)

A set of n-tuples r = {t1, t2, ..., tm}.

Signup and view all the flashcards

Constraints

Restrictions on actual values in a database state.

Signup and view all the flashcards

Domain Constraints

Typically include numeric data types, characters, booleans, fixed/variable-length strings, date/time, money, etc.

Signup and view all the flashcards

Key Constraints

No two tuples can have the same combination of values for all their attributes.

Signup and view all the flashcards

Superkey

No two distinct tuples in any state r of R can have the same value for SK (unique value).

Signup and view all the flashcards

Key

A superkey of R such that removing any attribute A from K leaves a set of attributes K that is not a superkey of R any more.

Signup and view all the flashcards

Candidate key

A relation schema may have more than one key.

Signup and view all the flashcards

Primary Key

Underline attribute that is the unique identifier

Signup and view all the flashcards

Entity Integrity Constraint

No primary key value can be NULL.

Signup and view all the flashcards

Referential Integrity Constraint

Specified between two relations. Maintains consistency among tuples in two relations.

Signup and view all the flashcards

Foreign key rules

Attributes in FK must have the same domain(s) as the primary key attributes PK.

Signup and view all the flashcards

Functional dependency constraint

Establishes a functional relationship among two sets of attributes X and Y

Signup and view all the flashcards

State constraints

Defines the constraints that a valid state of the database must satisfy

Signup and view all the flashcards

Transition constraints

Defines how state changes should happen with the database

Signup and view all the flashcards

Insert operation

Provides a list of attribute values for a new tuple t that is to be inserted into a relation R

Signup and view all the flashcards

Delete operation

If tuple being deleted is referenced by foreign keys from other tuples

Signup and view all the flashcards

Update Operation

Updating a primary or foreign key is required to specify a condition on the attributes of the relation.

Signup and view all the flashcards

Transaction

A database operation with an executing program.

Signup and view all the flashcards

OLTP

Online transaction processing (OLTP) systems.

Signup and view all the flashcards

First normal form

Flat relational model where composite and multivalued attributes not allowed

Signup and view all the flashcards

NULL Value

Value exists but is not available

Signup and view all the flashcards

Study Notes

  • Represents data as a collection of relations, also known as tables.
  • Table of values.
    • Has a table name (relation name).
    • Has rows (tuples).
      • Each represents a collection of related data values.
      • Each typically corresponds to a real-world entity or relationship.
    • Has column names (attributes).
      • Each interprets the meaning of values in the row.

Domain

  • Domain D is a set of atomic values.
  • Atomic implies each value is indivisible.
  • Specifying a domain requires data type specification.

Relation Schema R

  • Denoted by R(A1, A2, ...,An).
  • Consists of a relation name R and a list of attributes A1, A2, ..., An.

Attribute A

  • A name of a role played by some domain D in the relation schema R.

Degree (or arity) of a Relation

  • The number of attributes n of its relation schema.

Relation

  • Also known as relation state.
  • It is a set of n-tuples r = {t₁, t2, ..., tm}.
  • Each n-tuple t: An ordered list of n values t = <v1, v2, ..., vn>.
    • Each value v₁, where 1 ≤ i ≤ n is an element of dom(A₁) or a special NULL value.

Mathematical Relation

  • A relation can be described as a mathematical relation of degree n on the domains dom(A₁), dom(A2), ..., dom(An).
  • It is a subset of the Cartesian product of the domains that define R:
    • r(R) ⊆ (dom(A₁) × dom(A2) × ... × dom(An)).

Characteristics of Relations

  • Ordering of tuples in a relation does not matter.
    • Defined as a set of tuples which have no specific order.
  • Ordering of values within a tuple is also generally not significant.
    • The order of attributes and values is not critically important.

Alternative Definition of a Relation

  • A Tuple can be considered as a set of (, ) pairs.
  • Each pair gives the value of the mapping from an attribute A; to a value v; from dom(A;).
  • The first definition is used because attributes and values within tuples are conventionally ordered.

Values and NULLs in Tuples

  • Each value in a tuple is atomic (indivisible).
  • Composite and multivalued attributes are not allowed in the flat relational model, adhering to the First Normal Form assumption.
  • Multivalued attributes must be represented by separate relations.
  • Composite attributes: Represented only by simple component attributes in basic relational model.

NULL Values

  • Used to represent values of attributes that are unknown or do not apply to a tuple.
  • NULL values can have different meanings:
    • Value is unknown.
    • Value exists but is not available.
    • Attribute does not apply to this tuple (also known as value undefined).

Relational Model Notation

  • Uppercase letters Q, R, S denote relation names.
  • Lowercase letters q, r, s denote relation states.
  • Letters t, u, v denote tuples.
  • The name of a relation schema is, for example, STUDENT.
    • This indicates the current set of tuples in that relation.
  • Notation, for example,: STUDENT(Name, Ssn, ...).
    • Is used to refer only to the relation schema.
  • Attribute A can be qualified with the relation name R to which it belongs, using the dot notation R.A.

Relational Model Constraints

  • Restrictions are actual values in a database state.
  • Restrictions are derived from the rules which used in the database represents.
  • Restrictions are divided into Domain Constraints, Key Constraints, Entity Integrity Constraint, Referential Integrity Constraint, and others.

Domain Constraints

  • Check the datatypes for integers and real numbers, characters, booleans, fixed-length strings, variable-length strings, date, time, timestamp, money, and other special data types.

Key Constraints

  • No two tuples in any state should have the same combination of values for all their attributes.

Superkey

  • No two distinct tuples in any state r of R can have the same value for SK (unique value).

Key

  • A minimal superkey of R.
  • Removing any attribute A from K leaves a set of attributes that is not a superkey of R any more.

Key Satisfies Two Properties

  • Two distinct tuples in any state of relation cannot have identical values for (all) attributes in key.
  • Minimal superkey cannot remove any attributes and still have uniqueness constraint in above condition hold.

Candidate Key

  • A relation schema may have more than one key.

Primary Key

  • The key that is the underlined attribute, and has unique keys in a relation.

Integrity Restrictions

  • Entity Integrity Constraint: No primary key value can be NULL.
  • Referential Integrity Constraint: Specified between two relations which maintains consistency among tuples in two relations.
  • These restrictions mean the following. A row in a certain relationship when associated (refers) to the other relationship must indicate the row exists in this relationship.

Foreign Key Rules

  • Rules include that the attributes in FK have the same domain(s) as the primary key attributes PK.
  • Value of FK in a tuple t₁ of the current state r₁(R₁) either occurs as a value of PK for some tuple t₂ in the current state r₂(R2) or is NULL.
  • Diagrammatically display referential integrity constraints directed the arc from each foreign key to the relation it references.
  • All integrity constraints should be specified on relational database schema.

Foreign Keys

  • Dashed lines are placed under foreign keys.

Other Types of Constraints

  • Functional Dependency Constraint: Establishes a functional relationship between two sets of attributes X and Y. The value of X determines a unique value of Y.
  • State Constraints: Define the constraints that a valid state of the database must satisfy.
  • Transition Constraints: Define the constraints to deal with state changes in the database.

Update Operations

  • Operations of the relational model can be categorized into retrievals and updates.
  • Basic operations that change the states of relations in the database: insert, delete.
  • Update: Necessary to specify a condition on attributes of relation, and to select the tuple (or tuples) to be modified.

Update If Attributes Not Part of a Primary Key Nor of a Foreign Key

  • Usually, Update causes no problems.
  • Updating a primary/foreign key has similar issues as with Insert/Delete.

Relational Database Schema

  • Is the set of relation schemas S = {R1, R2, ..., Rm}.
  • The set of integrity constraints is IC.

Relational Database State

  • Is the set of relation states DB = {r1, r2, ..., rm}.
  • Each r; is a state of R, and such that the r; relation states satisfy integrity constraints specified in IC.
  • Invalid state does not obey all the integrity constraints.
  • Valid state satisfies all the constraints in the defined set of integrity constraints IC.

Insert Operation

  • Provides a list of attribute values for a new tuple t that is to be inserted into a relation R.
  • Can violate any of the four types of constraints.
  • If an insertion violates one or more constraints, the default option is to reject the insertion.

Delete Operation

  • Can violate only referential integrity.
  • If tuple being deleted is referenced by foreign keys from other tuples:
    • Restrict, reject the deletion.
    • Cascade, propagate the deletion by deleting tuples that reference the tuple that is being deleted.
    • Set null or set default, modify the referencing attribute values that cause the violation.

Transaction

  • Executing program and includes some database operations.
  • Must leave the database in a valid or consistent state.

Online Transaction Processing (OLTP) Systems

  • Execute transactions at rates that reach several hundred per second.

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
Database Design and Relational Model
24 questions
Relational Model Fundamentals
20 questions

Relational Model Fundamentals

UnparalleledSerpentine1420 avatar
UnparalleledSerpentine1420
Use Quizgecko on...
Browser
Browser