Download Informix Guide to SQL: Tutorial

Transcript
Some Basic Concepts
In relational terminology, projection is defined as taking a vertical subset from
the columns of a single table that retains the unique rows. This kind of
SELECT statement returns some of the columns and all of the rows in a table.
Projection is implemented through the select list in the SELECT clause of a
SELECT statement, as Query 2-2 shows.
Query 2-2
SELECT UNIQUE city, state, zipcode
FROM customer
Query Result 2-2 contains the same number of rows as the customer table,
but it projects only a subset of the columns in the table.
Query Result 2-2
city
state zipcode
Bartlesville
Blue Island
Brighton
Cherry Hill
Denver
Jacksonville
Los Altos
Menlo Park
Mountain View
Mountain View
Oakland
Palo Alto
Palo Alto
Phoenix
Phoenix
Princeton
Redwood City
Redwood City
Redwood City
San Francisco
Sunnyvale
Sunnyvale
Wilmington
OK
NY
MA
NJ
CO
FL
CA
CA
CA
CA
CA
CA
CA
AZ
AZ
NJ
CA
CA
CA
CA
CA
CA
DE
74006
60406
02135
08002
80219
32256
94022
94025
94040
94063
94609
94303
94304
85008
85016
08540
94026
94062
94063
94117
94085
94086
19898
Composing Simple SELECT Statements
2-7