Databases Reference
In-Depth Information
SELECT DISTINCTROW
[ISBN] & " from " & [PubName] AS [ISBN from PubName]
FROM PUBLISHERS INNER JOIN BOOKS ON PUBLISHERS.PubID = BOOKS.PubID;
returns a single-column result table ISBN-PUB, as shown in Table 6-10.
Table 6-10. The ISBN-PUB table
ISBN from PubName
0
-12-345678-9 from Small House
0-11-345678-9 from Small House
0
-321-32132-1 from Small House
0
-55-123456-9 from Small House
0
-12-333433-3 from Big House
0-103-45678-9 from Big House
0
-91-335678-7 from Big House
0-99-999999-9 from Big House
1
-22-233700-0 from Big House
1
-1111-1111-1 from Big House
0
-91-045678-5 from Alpha Press
0-555-55555-9 from Alpha Press
0
-99-777777-7 from Alpha Press
0
-123-45678-0 from Alpha Press
Not only does the AS
AliasName
option allow us to name a
compound column
, it also
allows us to rename duplicate column names without having to qualify the names.
6.7.3.3 FROM TableExpression
The FROM clause specifies the tables (or queries) from which the SELECT statement is
to take its rows. The expression
TableExpression
can be a single table name, several table
names separated by commas, or a join clause. The
TableExpression
may also include the
AS
AliasName
syntax for table-name aliases.
When tables are separated by commas in the FROM clause, a Cartesian product is
formed. For example, the statement:
SELECT *
FROM AUTHORS, PUBLISHERS;
will produce the Cartesian product of the two tables.
6.7.3.4 WHERE RowCondition
The
RowCondition
is any Access expression that specifies which rows are included in the
result table. Expressions can involve column names, constants, arithmetic (=, <, >, <=,
>=, < >, BETWEEN) and logical (AND, OR, XOR, NOT, IMP) relations, as well as
functions. Here are some examples: