Wednesday, November 29, 2006

Query Languages and the Relational Algebra

Access SQL is a special form of standard SQL.

Query Languages

query - a request of the database, the response to which is a result table.

Queries permit me to extract the data from the database in meaningful forms.

Query languages can be based on algebraic expression or logical expressions.

base table - a table whose data are actually stored in the database.

view - a query expression that has been given a name, and is stored in the database. The expression is the view and not the result table.

virtual table - a view because it is an expression that results in a table.

Relational Algebra and Relational Calculus

relational algebra - the most common algebraic query language.

procedural - the expression describe an explicit procedure for returning the results. Relational algebra is a procedural language.

relational calculus - uses logic.

nonprocedural - expressions represent statements that describe conditions that must be met for a row to be in the result. Example is relational calculus.

Plan English:

Get the names and phone numbers for publishers who publish books costing under $20.00.

Relational Algebra:

projPubName,PubPhone(selPrice<20.00(BOOKS join PUBLISHERS))

Relational Calculus:

{(x,y) | PUBLISHERS(z,x,y) and BOOKS(a,b,z,c) and c < $20.00}

No comments: