vault backup: 2024-01-21 00:27:23

This commit is contained in:
2024-01-21 00:27:23 +00:00
parent 358e43950b
commit 7a6e5c1b31
46 changed files with 1226 additions and 14 deletions

View File

@@ -1,7 +1,10 @@
### [Relational Algebra - Recap](obsidian://open?vault=Computer%20Science%20Year%201&file=Semester%201%2FDatabase%20Systems%2FWeek%2010%2FWeek%2010)
### [Relational Algebra - Recap](obsidian://open?vault=Computer%20Science%20Year%201&file=Semester%201%2FDatabase%20Systems%2FWeek%2010%2FWeek%2010%20Database%20Systems)
- High level & procedural
- Defines how to build relations
- SELECT represented by pi ( projection )
- FROM represented by sigma ( selection )
- WHERE represented by x ( cartesian product )
#### Data Manipulation Language
@@ -14,3 +17,21 @@
- Operations work on one or more relations to define another relation without changing the original
- Both operands and results are relations, output from one operation can become the input for another operation.
- This allows nested expressions.
#### Theta Join
R theta(f) S defines a relation that contains tuples satisfying F from the Cartesian product of two relations R and S.
Takes the Cartesian product of two relations r and s than selects the rows which satisfy the condition F.
R theta(f) S is the same as sigma(f) (R x S ).
F may contain comparison operators to form a condition.
#### Query Processing
The activities involved in parsing, validating, optimising and executing a query.
Purpose is to transform a query written in a high level language into correct and efficient strategy in low level language. Also to execute strategy to retrieve data.
#### Common Optimisation Rules
- Begin with initial query tree for SQL
- Move SELECT operations down the tree
- Apply more restrictive SELECT operations first ( eg. equalities before range queries )
- Replace Cartesian products followed by selection with theta joins ( eg. *sigma(f) ( RxS )* -> *R theta(f) S* )
- Move PROJECT operations down the query tree ( add project operations as inputs to theta joins )