This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Introduction to RA and SQL Queries and Operations SQL and Relational Algebra T. M. Murali August 30, 2010 T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations What is SQL? I SQL = Structured Query Language (pronounced“sequel”). I Language for defining as well as querying data in an RDBMS. I Primary mechanism for querying and modifying the data in an RDBMS. I SQL is declarative: I Say what you want to accomplish, without specifying how. I One of the main reasons for the commercial success of RDMBSs. I SQL has many standards and implementations: I ANSI SQL I SQL92/SQL2 (null operations, outerjoins) I SQL99/SQL3 (recursion, triggers, objects) I Vendorspecific variations. T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations What is Relational Algebra? I Relational algebra is a notation for specifying queries about the contents of relations. I Relational algebra eases the task of reasoning about queries. I Operations in relational algebra have counterparts in SQL. I To process a query, a DBMS translates SQL into a notation similar to relational algebra. T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations What is an Algebra? I An algebra is a set of operators and operands. T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations What is an Algebra? I An algebra is a set of operators and operands. I Arithmetic: operands are variables and constants, operators are + , , × , ÷ ,/ , etc. I Set algebra: operands are sets and operators are ∪ , ∩ , . T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations What is an Algebra? I An algebra is a set of operators and operands. I Arithmetic: operands are variables and constants, operators are + , , × , ÷ ,/ , etc. I Set algebra: operands are sets and operators are ∪ , ∩ , . I An algebra allows us to construct expressions by combining operands and expression using operators and has rules for reasoning about expressions. I a 2 + 2 × a × b + b 2 , ( a + b ) 2 . I R ( R S ) , R ∩ S . T. M. Murali August 30, 2010 CS4604: SQL and Relational Algebra Introduction to RA and SQL Queries and Operations Basics of Relational Algebra I Operands are relations, thought of as sets of tuples. I Think of operands as variables, whose tuples are unknown. I Results of operations are also sets of tuples. (Later, we will define a relational algebra on bags.) I Think of expressions in relational algebra as queries , which construct new relations from given relations....
View
Full
Document
This note was uploaded on 12/24/2011 for the course CS 4604 taught by Professor Cmmalik during the Fall '08 term at Virginia Tech.
 Fall '08
 CMMALIK

Click to edit the document details