Sie sind auf Seite 1von 2

List the complete Item table.

3. List the number and name of all customers represented by rep 15.
Sql query:
SELECT Customer.CustomerName, Customer.CustomerNum
FROM Customer
Where Customer.RepNum='15';
ANSWER:
CustomerName CustomerNum
Toys Galore
126
Cards and More 502
Cress Store
713
All Season Gifts 893

4. List the number and name of all customers that are represented by rep 15 and that have a credit
limit of $10,000.
SQL query:
SELECT Customer.CustomerNum, Customer.CustomerName
FROM Customer
WHERE (((Customer.CreditLimit)=10000) AND ((Customer.RepNum)="15"));
CustomerNum CustomerName
713
Cress Store
5. List the number and name of all customers that are represented by rep 15 or that have a credit limit
of $10,000.
SQL query:
SELECT Customer.CustomerNum, Customer.CustomerName
FROM Customer
WHERE (((Customer.CreditLimit)=10000) OR ((Customer.RepNum)="15"));
Answer:
CustomerNum
126
260
502
713
893

CustomerName
Toys Galore
Brookings Direct
Cards and More
Cress Store
All Season Gifts

6. For each order, list the order number, order date, number of the customer that placed the order, and
name of
the customer that placed the order.

SQL query is:


SELECT OrderLine.OrderNum, Orders.OrderDate, Count(Customer.CustomerName) AS
CountOfCustomerName, Customer.CustomerName

FROM Customer INNER JOIN (Orders INNER JOIN OrderLine ON Orders.OrderNum =


OrderLine.OrderNum) ON Customer.CustomerNum = Orders.CustomerNum
GROUP BY OrderLine.OrderNum, Orders.OrderDate, Customer.CustomerName;

Design view:

Answer:
OrderNum OrderDate

Count

CustomerName

51608

10/12/2015 1

Toys Galore

51610

10/12/2015 2

The Everything Shop

51613

10/13/2015 1

Johnson's Department Store

51614

10/13/2015 1

Brookings Direct

51617

10/15/2015 2

Almondton General Store

51619

10/15/2015 1

Toys Galore

51623

10/15/2015 3

Almondton General Store

51625

10/16/2015 1

Unique Gifts

Das könnte Ihnen auch gefallen