Wikibooks: Relational Database Design/Retrieving data

= Relational Algebra = The relational algebra is a formal language used to express database or relational operations. The most important operations are σ(lower cased Sigma) select values with a condition) Π(Uppercase pie) project only show the named attributes X OR Cross Product (each row of one rel...

Full description

Bibliographic Details
Format: Book
Language:English
Subjects:
DML
Online Access:https://en.wikibooks.org/wiki/Relational_Database_Design/Retrieving_data
Description
Summary:= Relational Algebra = The relational algebra is a formal language used to express database or relational operations. The most important operations are σ(lower cased Sigma) select values with a condition) Π(Uppercase pie) project only show the named attributes X OR Cross Product (each row of one relation shown combined with every row of another relation) (join on a condition equijoin natural join (an equijoin on the common fields of two relations) ). Also the set operations of union intersection difference A \cup B A \cap B A B (where x is not an element of A intersect B). There is also a division operation which is like a natural join where the attributes of a second relation is a subset of the attributes of the first relation and only the rows of the first relation which have the values in the corresponding attributes in the second relation are selected and the non common attributes projected. A divided by B might be better said A given B or all the rows in A that will show all the rows in B. = Relational Calculus = = SQL = SQL statements are divided into two types data declaration statements (DDL) and data manipulation statements (DML) (the L is for language ). = Data Manipulation SQL = This is by far the majority use of SQL as once a database is designed SQL data manipulation is usually flexible enough to get around poor design and null values are allowed so poorly designed normalization can be gotten around by leaving fields empty. Therefore it pays to know about the data manipulation statements over the data declaration statements in order to know how to cope with bad design which is likely to be a more likely reason for hiring than an expert in Extract Transform and Load who is also a whiz at optimally normalized database design. = RETRIEVING DATA = Retrieving data from a database using SQL is achieved using the SELECT keyword and can range from using a very simple statement to retrieve a single column from a table to an incredibly complex statement using conditional joining grouping ordering limiting ...