COSI 127b Lecture Notes - Lecture 2: Relational Algebra
Document Summary
Sql, structured query language, is the standard data definition and manipulation language for relational databases. Select from where queries keep duplicates, unless the distinct keyword is added after the select clause. The as keyword is similar to the rename operation in the relational algebra. Select is similar to projection in relational algebra, from is similar to the cartesian product, and where is similar to selection in the relational algebra. Sql has aggregate operations for the average, sum, count, maximum, and minimum. Operations with null usually result in null, except for count which results in zero instead. The evaluation order of sql clauses is: from, where, group by, having, select, order by, into. A correlated nested query is a type of nested query whose inner query references the outer relation, or table. The clause delete can be used instead of select for deletions. The insert into clause is used for inserting data.