Chapter 2 Relational Models (Gemini)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/36

flashcard set

Earn XP

Description and Tags

Slide 31 och framåt är från slide-presentationen - det som inne var med i begreppen från boken.

37 Terms

1
New cards

Table

A two-dimensional grid of rows and columns used to store data. In the relational model, a table corresponds mathematically to a relation.

2
New cards

Relation

A formal mathematical term for a table, consisting of a set of unordered tuples (rows) that all share the same attributes (columns).

3
New cards

Tuple

A single row in a relation representing a specific, individual record or entity instance.

4
New cards

Attribute

A single column in a relation representing a specific property, characteristic, or field of the relation.

5
New cards

Relation instance

The actual collection of tuples present in a relation at a specific point in time (the current content of the table).

6
New cards

Domain

The predefined set of all allowable values for a given attribute (e.g., integers, dates, or strings of a certain length).

7
New cards

Atomic domain

A domain where each individual value is indivisible or simple (e.g., a single number or text string, rather than a list or nested structure).

8
New cards

Database schema

The overall logical blueprint or design of the entire database.

9
New cards

Database instance

A snapshot of all the data contained in the database at a specific moment in time.

10
New cards

Relation schema

The logical blueprint of a single relation, defined by its name and a list of its attributes (e.g., Student(ID, Name, Department)).

11
New cards

Keys

Attributes or sets of attributes used to uniquely identify tuples or establish relationships between tables.

12
New cards

Superkey

A set of one or more attributes that, taken collectively, allow us to uniquely identify every tuple in a relation.

13
New cards

Candidate key

A minimal superkey—a superkey from which no proper subset is also a superkey (meaning no redundant attributes are included).

14
New cards

Primary key

The specific candidate key chosen by the database designer as the principal means of identifying tuples within a relation.

15
New cards

Primary key constraints

Rules stating that primary key attributes must contain unique values for every tuple and cannot contain null values.

16
New cards

Foreign-key constraint

A rule ensuring that values in a referencing attribute match the primary key values in a referenced table, maintaining structural consistency.

17
New cards

Referencing vs Referenced relation (Foreign key constraint)

  • Referencing relation: The table that contains the foreign key pointing to another table.

  • Referenced relation: The table containing the primary key being pointed to.


18
New cards

Referential integrity constraint

A general rule ensuring that relationships between tables remain valid (e.g., you cannot assign an invalid department ID to a student).

19
New cards

Schema diagram

A graphical illustration showing database relations, their attributes, primary keys, and foreign-key relationships.

20
New cards

Query Language Types (3 st)

  • Imperative: Query languages where the user specifies how to compute the result through an explicit, step-by-step procedural sequence.

  • Functional: Query languages where queries are constructed by applying functions to data collections or other functions.

  • Declarative (Nonprocedural): Query languages where the user specifies what data is desired without needing to provide the step-by-step execution path (e.g., SQL).


21
New cards

Relational algebra & Relational-algebra expression

  • Relational algebra: A procedural query language that takes one or more relations as input and returns a new relation as output using specific mathematical operations.

  • Relational-algebra expression: A combination of relation names, constants, and relational-algebra operators that evaluates to a relation.


22
New cards
<p>Select (<span>$\sigma$</span>)</p>

Select (σ\sigma)

Filters rows (tuples) that satisfy a specified predicate condition. (σcondition(Relation)\sigma_{\text{condition}}(\text{Relation}))

23
New cards
<p>Project (<span>$\Pi$</span>)</p>

Project (Π\Pi)

Filters columns (attributes) and removes any resulting duplicate rows. (Πattributes(Relation)\Pi_{\text{attributes}}(\text{Relation}))

24
New cards
<p>Cartesian product (<span>$\times$</span>)</p>

Cartesian product (×\times)

Combines every tuple of the first relation with every tuple of the second relation. (R×SR \times S)

25
New cards
<p>Join (<span>$\bowtie$</span>)</p>

Join (⋈\bowtie)

Combines a Cartesian product with a selection condition into a single operation, linking related tuples from two relations based on matching attributes.

26
New cards
<p>Union (<span>$\cup$</span>)</p>

Union (∪\cup)

Combines tuples from two union-compatible relations, automatically eliminating duplicates. (R∪SR \cup S)

27
New cards
<p>Set difference (<span>$-$</span>)</p>

Set difference (−-)

Returns tuples that are present in the first relation but not in the second. (R−SR - S)

28
New cards
<p>Set intersection (<span>$\cap$</span>)</p>

Set intersection (∩\cap)

Returns only the tuples that exist in both relations. (R∩SR \cap S)

29
New cards
<p>Assignment (<span>$\leftarrow$</span>)</p>

Assignment (←\leftarrow)

Assigns the result of a relational-algebra expression to a temporary relation variable.

30
New cards
<p>Rename (<span>$\rho$</span>)</p>

Rename (ρ\rho)

Renames a relation or its attributes to avoid naming conflicts. (ρS(A,B)(R)\rho_{S(A, B)}(R))

31
New cards

Naive set Theory foundations: (union, intersection, set difference, and Cartesian products)

The slides establish set theory as the mathematical basis for the relational model. They review set definitions, cardinality, subsets, and fundamental set operations (union, intersection, set difference, and Cartesian products) along with their commutative and associative properties.

32
New cards

Intensional vs. Extensional Data Definitions

The course explicitly contrasts intensional data definitions (the schema and specifications of what data we want, such as DDL statements and queries) with extensional data definitions (the data itself stored in relation instances).

33
New cards

Comprehensive Constraint Categorization (3 cathegories)

  • Implicit (Data Model) Constraints: Inherent rules of the relational model, such as the prohibition of duplicate tuples and lack of implicit ordering.

  • Explicit (Schema) Constraints: Schema-based rules defined via DDL, including domain, key, entity integrity, and referential integrity constraints.

  • Application Constraints: Complex business rules that cannot be derived from the schema alone (e.g., maximum credit limits), which are enforced via application code, database assertions, or triggers.


34
New cards

Integrity Constraint Enforcement Strategies (INSERT, UPDATE, and DELETE operations)

The slides provide detailed strategies for how a DBMS maintains integrity during INSERT, UPDATE, and DELETE operations. This includes specific handling mechanisms like rejecting violations, setting foreign keys to NULL, and executing Cascade Deletes to automatically remove referencing child tuples.

35
New cards

Outer joins

Left, Right, and Full Outer Joins that preserve non-matching tuples by padding missing values with NULL.

36
New cards

Grouped Aggregation

Performing aggregate functions (Sum, Average, Min, Max, Count) grouped by specific attributes directly within relational algebra.

37
New cards

Query Trees

The internal tree data structures used by database management systems for bottom-up query evaluation, execution, and optimization.