ics321-20091001-relalgebra

ics321-20091001-relalgebra - ICS 321 Fall 2009 Relational...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 321 Fall 2009 Relational Algebra Asst. Prof. Lipyeow Lim University of Hawaii at Manoa 10/01/2009 1 Lipyeow Lim -- University of Hawaii at Manoa
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Relational Query Languages Query languages : Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Strong formal foundation based on logic. Allows for much optimization. Query Languages != programming languages! QLs not expected to be “Turing complete”. QLs not intended to be used for complex calculations. QLs support easy, efficient access to large data sets. 10/01/2009 Lipyeow Lim -- University of Hawaii at Manoa 2
Background image of page 2
Formal Relational Query Languages Two mathematical Query Languages form the basis for “real” languages (e.g. SQL), and for implementation: Relational Algebra : More operational , very useful for representing execution plans. Relational Calculus : Lets users describe what they want, rather than how to compute it. ( Non- operational, declarative .) 10/01/2009 Lipyeow Lim -- University of Hawaii at Manoa 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Preliminaries A query is applied to relation instances , and the result of a query is also a relation instance. Schemas of input relations for a query are fixed (but query will run regardless of instance!) The schema for the result of a given query is also fixed! Determined by definition of query language constructs. Positional vs. named-field notation: Positional notation easier for formal definitions, named-field notation more readable. Both used in SQL 10/01/2009 Lipyeow Lim -- University of Hawaii at Manoa 4
Background image of page 4
Example Relational Instances “Sailors” and “Reserves” relations for our examples. We’ll use positional or named field notation, assume that names of fields in query results are `inherited’ from names of fields in query input relations sid bid day 22 101 10/10/96 58 103 11/12/96 10/01/2009 Lipyeow Lim -- University of Hawaii at Manoa 5 sid sname rating age 22 Dustin 7 45.0 31 Lubber 8 55.5 58 Rusty 10 35.0 R1 S1 S2 sid sname rating age 28 Yuppy 9 35.0 31 Lubber 8 55.5 44 Guppy 5 35.0 58 Rusty 10 35.0
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Relational Algebra Basic operations: Selection ( ς ) Selects a subset of rows from relation. Projection ( π ) Deletes unwanted columns from relation. Cross-product ( × ) Allows us to combine two relations. Set-difference ( ) Tuples in reln. 1, but not in reln. 2. Union
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 24

ics321-20091001-relalgebra - ICS 321 Fall 2009 Relational...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online