0% found this document useful (0 votes)
94 views2 pages

Session3 2

The document contains 6 SQL queries and their results. Query 1 lists the name and number of all customers represented by rep 15. Query 2 lists those customers represented by rep 15 that have a credit limit of $10,000. Query 3 lists customers represented by rep 15 or that have a credit limit of $10,000. Query 4 lists order numbers, dates, customer numbers and names for each order. The results show customer and order details from the database.

Uploaded by

Wilsmith Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views2 pages

Session3 2

The document contains 6 SQL queries and their results. Query 1 lists the name and number of all customers represented by rep 15. Query 2 lists those customers represented by rep 15 that have a credit limit of $10,000. Query 3 lists customers represented by rep 15 or that have a credit limit of $10,000. Query 4 lists order numbers, dates, customer numbers and names for each order. The results show customer and order details from the database.

Uploaded by

Wilsmith Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like