Relational Algebra and SQL - Cornell University
Relational Algebra and SQL
Johannes Gehrke johannes@cs.cornell.edu
Slides from Database Management Systems, 3rd Edition,
Ramakrishnan and Gehrke.
Database Management Systems, R. Ramakrishnan and J. Gehrke
1
Relational Query Languages
v Query languages: Allow manipulation and retrieval of data from a database.
v Relational model supports simple, powerful QLs:
? Strong formal foundation based on logic. ? Allows for much optimization.
v 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.
Database Management Systems, R. Ramakrishnan and J. Gehrke
2
Formal Relational Query Languages
v 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. (Nonoperational, declarative.)
Database Management Systems, R. Ramakrishnan and J. Gehrke
3
Preliminaries
v 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.
v Positional vs. named-field notation:
? Positional notation easier for formal definitions, named-field notation more readable.
? Both used in SQL
Database Management Systems, R. Ramakrishnan and J. Gehrke
4
R1 sid bid day
Example Instances 22 101 10/10/96
58 103 11/12/96
v "Sailors" and "Reserves" relations for our examples.
S1 sid
sname
rating
age
v We'll use positional or
22 dustin 7 45.0
named field notation,
31 lubber 8 55.5
assume that names of fields in query results are
58 rusty
10 35.0
`inherited' from names of fields in query input relations.
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
Database Management Systems, R. Ramakrishnan and J. Gehrke
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 075 2009 renaming in batches sas
- relational algebra ii california institute of technology
- relational algebra and sql cornell university
- directquery in sql server 2016 analysis services
- guide to using sql synonyms and the rename statement oracle
- pro power bi desktop semantic scholar
- nested queries and aggregation cheriton school of computer science
- automatically renaming common variables before merging
- renaming a computer that hosts a stand alone sql server instance
- cs 450 relational algebra 1 george mason university
Related searches
- cornell university data analytics program
- cornell university data analytics certificate
- cornell university business analytics
- cornell university business
- cornell university johnson business school
- cornell university college of business
- cornell university college report
- cornell university reputation
- cornell university data analytics
- cornell university dyson business school
- cornell university johnson
- cornell university johnson school