Database Reference
In-Depth Information
EXAMPLE 9
List the descriptions of all parts that are located in warehouse 3 or for which there are more than 20 units on
hand or both.
109
SELECT Description
FROM Part
WHERE Warehouse=
'
3
'
OR OnHand
>
20
;
EXAMPLE 10
List the descriptions of all parts that are not in warehouse 3.
SELECT Description
FROM Part
WHERE NOT Warehouse=
'
3
'
;
EXAMPLE 11
List the number, name, and balance of all customers with balances greater than or equal to $1,000 and less
than or equal to $5,000.
SELECT CustomerNum, CustomerName, Balance
FROM Customer
WHERE Balance BETWEEN 1000 AND 5000
;
EXAMPLE 12
List the number, name, and available credit for all customers.
SELECT CustomerNum, CustomerName, CreditLimit-Balance AS AvailableCredit
FROM Customer
;
EXAMPLE 13
List the number, name, and available credit for all customers with credit limits that exceed their balances.
SELECT CustomerNum, CustomerName, CreditLimit-Balance AS AvailableCredit
FROM Customer
WHERE CreditLimit
>
Balance
;