Database Reference
In-Depth Information
SUMMARY OF SQL COMMANDS
This section contains generic versions of SQL commands for every example presented in this chapter. (The
example numbers match the ones used in the chapter, making it easy to return to the page in the chapter on
which the example is described.) In most cases, commands in Access are identical to the generic versions.
For those commands that differ in other SQL implementations, both the generic version and the Access ver-
sion are included.
107
EXAMPLE 1
Use SQL to create the Rep table by describing its layout.
CREATE TABLE Rep
(RepNum CHAR(2),
LastName CHAR(15),
FirstName CHAR(15),
Street CHAR(15),
City CHAR(15),
State CHAR(2),
Zip CHAR(5),
Commission DECIMAL(7,2),
Rate DECIMAL(3,2) )
;
Access:
CREATE TABLE Rep
(RepNum CHAR(2),
LastName CHAR(15),
FirstName CHAR(15),
Street CHAR(15),
City CHAR(15),
State CHAR(2),
Zip CHAR(5),
Commission CURRENCY,
Rate NUMBER )
;
EXAMPLE 2
List the number, name, and balance of all customers.
SELECT CustomerNum, CustomerName, Balance
FROM Customer
;
EXAMPLE 3
List the complete Part table.
SELECT *
FROM Part
;
Search WWH ::




Custom Search