Flash Cards Relatioanl Algebra

Description

Explanation more about What is Relational Algebra?
nurhidayah.mazni
Flashcards by nurhidayah.mazni, updated more than 1 year ago
nurhidayah.mazni
Created by nurhidayah.mazni over 8 years ago
81
4

Resource summary

Question Answer
Basic of "RELATIONAL ALGEBRA" Operations
Projection * Retains only attributes that are in the “projection list". *The 1st query will produce a relation with only one column which is age. While the 2nd query produces a relation with two columns: sname and rating. * The number of rows depends on the number of unique content. e.g. 1st query, 2 rows, 2nd query, 4 rows. # Projection operator eliminates duplicates rows .
Selection # Selects rows that satisfy selection condition. Can also have multiple conditions. # Result is a relation with same number of columns BUT probably lesser number of rows.
Union and Set-Difference All of these operations take two input relations, which must be union compatible: - Same number of fields. - Corresponding’ fields have the same type.
Union
Set Difference
Cross-Product Result schema has one field per field of R1 and R2, with field names `inherited’ if possible. May have a naming conflict: Both R1 and R2 have a field with the same name.
Compound Operator: Intersection Intersection takes two input relations, which must be union-compatible.. Q: How to express it using basic operators?
Intersection
Compound Operator: Join Joins are compound operators involving cross product, selection, and (sometimes) projection. Most common type of join is a “natural join” (often just called “join”). R S conceptually is: Compute R X S Select rows where attributes that appear in both relations have equal values and domains. Project all unique atttributes and one copy of each of the common ones.
Natural Join Example
Outer Joins Left outer Join: each row in R1 will appear in results even if no matching row of R2 (null). Right outer Join: each row in R2 will appear in results even if no matching row of R1 (null). Full outer Join: each row in R1 will appear in even if no matching row of R2 and each row of R2 will appear even if no matching row of R1.
Compound Operator: Division Examples of Division A/B (AB)
Aggregate Functions Aggregation function takes a collection of values and returns a single value as a result. avg: average value min: minimum value max: maximum value sum: sum of values count: number of values
Aggregate Operations Aggregate operation in relational algebra. G1, G2, …, Gn ℱ F1( A1), F2( A2),…, Fn( An) (E) E is any relational-algebra expression. G1, G2 …, Gn is a list of attributes on which to group (can be empty). Each Fi is an aggregate function. Each Ai is an attribute name
Aggregate Operation – Example
Assignment Operation The assignment operation () provides a convenient way to express complex queries. *Write query as a sequential program consisting of a series of assignments followed by an expression whose value is displayed as a result of the query. *Assignment must always be made to a temporary relation variable.
Show full summary Hide full summary

Similar

GCSE Maths Symbols, Equations & Formulae
livvy_hurrell
GCSE Maths Symbols, Equations & Formulae
Andrea Leyden
GCSE Maths: Algebra & Number Quiz
Andrea Leyden
Using Formulas
grace0448
GCSE Maths: Understanding Pythagoras' Theorem
Micheal Heffernan
All AS Maths Equations/Calculations and Questions
natashaaaa
AS level Maths Equations to Remember
Gurdev Manchanda
Trigonometry, Equations, Pythagoras theorem
Caitlin Mortlock
Transforming Graphs
james_hobson
A-level Maths: Key Differention Formulae
humayun.rana
Algebraic & Geometric Proofs
Selam H