You are on page 1of 4

July 18th 2018 1

Upload Assignment: Assignment: Using SQL Commands

In this module, you examined a new programming language, Structured Query


Language (SQL). Use SQL to query a relational database, by entering commands to
obtain desired results. The commands used to retrieve table data are called queries.
For this assignment, you will write SQL commands to retrieve data from TAL
Distributors. First, download an original copy of TAL Distributors – Chapter 3:
Database. Use Microsoft Access to open the database, and complete the following
exercises.
1. List the number and name of all customers.
SELECT CustomerNum, CustomerName
FROM Customer
;

Query1
CustomerNum CustomerName
126 Toys Galore
260 Brookings Direct
334 The Everything Shop
386 Johnson's Department Store
440 Grove Historical Museum Store
502 Cards and More
586 Almondton General Store
665 Cricket Gift Shop
713 Cress Store
796 Unique Gifts
824 Kline's
893 All Season Gifts
July 18th 2018 1

2. List the complete item table.


SELECT *
FROM Item
;
Query2
ItemNum Description OnHand Category Storehouse Price
AH74 Patience 9 GME 3 $22.99
BR23 Skittles 21 GME 2 $29.99
CD33 Wood Block Set (48 piece) 36 TOY 1 $89.49
DL51 Classic Railway Set 12 TOY 3 $107.95
DR67 Giant Star Brain Teaser 24 PZL 2 $31.95
DW23 Mancala 40 GME 3 $50.00
FD11 Rocking Horse 8 TOY 3 $124.95
FH24 Puzzle Gift Set 65 PZL 1 $38.95
KA12 Cribbage Set 56 GME 3 $75.00
KD34 Pentominoes Brain Teaser 60 PZL 2 $14.95
KL78 Pick Up Sticks 110 GME 1 $10.95
MT03 Zauberkasten Brain Teaser 45 PZL 1 $45.79
NL89 Wood Block Set (62 piece) 32 TOY 3 $119.75
TR40 Tic Tac Toe 75 GME 2 $13.99
TW35 Fire Engine 30 TOY 2 $118.95

3. List the number and name of every customer represented by Rep 15.
SELECT CustomerNum, CustomerName
FROM Customer
WHERE RepNum='15'
;
Query3
CustomerNum CustomerName
126 Toys Galore
502 Cards and More
713 Cress Store
893 All Season Gifts

4. List the number and name of all customers that are represented by Rep
15 and that have credit limits of $10,000.
SELECT CustomerNum, CustomerName
July 18th 2018 1

FROM Customer
WHERE RepNum='15'
AND CreditLimit =10000
;

Query4
CustomerNum CustomerName
713 Cress Store

5. List the number and name of all customers that are represented by Rep 15 or that
have credit limits of $10,000.
SELECT CustomerNum, CustomerName
FROM Customer
WHERE RepNum='15'
OR CreditLimit =10000
;

Query5
CustomerNum CustomerName
126 Toys Galore
260 Brookings Direct
502 Cards and More
713 Cress Store
893 All Season Gifts

6. List the number and name of all customers represented by Megan Gradey.
Megan Gradey is Rep Number 30

SELECT CustomerNum, CustomerName


FROM Customer
WHERE RepNum ='30'
;
Query6
CustomerNum CustomerName
260 Brookings Direct
386 Johnson's Department Store
665 Cricket Gift Shop
824 Kline's
July 18th 2018 1

7. List all columns and all rows in the Item table. Sort the results by Item description in
ascending order.
SELECT *
FROM Item
ORDER BY Description ASC
;
Query7
ItemNum Description OnHand Category Storehouse Price
DL51 Classic Railway Set 12 TOY 3 $107.95
KA12 Cribbage Set 56 GME 3 $75.00
TW35 Fire Engine 30 TOY 2 $118.95
DR67 Giant Star Brain Teaser 24 PZL 2 $31.95
DW23 Mancala 40 GME 3 $50.00
AH74 Patience 9 GME 3 $22.99
KD34 Pentominoes Brain Teaser 60 PZL 2 $14.95
KL78 Pick Up Sticks 110 GME 1 $10.95
FH24 Puzzle Gift Set 65 PZL 1 $38.95
FD11 Rocking Horse 8 TOY 3 $124.95
BR23 Skittles 21 GME 2 $29.99
TR40 Tic Tac Toe 75 GME 2 $13.99
CD33 Wood Block Set (48 piece) 36 TOY 1 $89.49
NL89 Wood Block Set (62 piece) 32 TOY 3 $119.75
MT03 Zauberkasten Brain Teaser 45 PZL 1 $45.79

You might also like