Homework Assignment #01 TAL Distributors [ERD] Helpful Hints 1/20/2016

advertisement
1/20/2016
Class 01.02 Hints
Homework Assignment #01
Helpful Hints
TAL Distributors [ERD]
Concepts of Database Management, 8th Edition, Pratt & Last
1
1/20/2016
TAL 1‐01
1.1 List the names of all customers that have a credit limit less than $10,000.
Datasheet views
Query Design/QBE View
TAL 1‐01
1.1 List the names of all customers that have a credit limit less than $10,000.
Datasheet view
Design/QBE View
SQL View (Optional for Hwk 1)
SELECT Customer.CustomerNum, Customer.CustomerName, Customer.CreditLimit
FROM Customer
WHERE (((Customer.CreditLimit)<10000));
Concepts of Database Management, 8th Edition, Pratt & Last
2
1/20/2016
Snipping Tool (in accessories)
SnagIt Tool, etc.
Rule #5: Solving All Queries?
1. Start with the Answer
represented as a table or view
OrderNum
Descrip‐
tion
NumOrdered
LastName
Source
Tables:
Orders
Part
OrderLine
Rep
Sample
data:
2001
BV06
5
2. Determine where the columns
MUST come from:
Hull
3. Build the QBE View(s); One
or Two or more queries?
4. Solve (WHERE) Criteria
(rows) Problem?
5. Run the Query Datasheet
View
3
1/20/2016
Colonial Adventure Tours
Concepts of Database Management, 8th Edition, Pratt & Last
Problem CAT 1‐12
Helpful Hints: Step 1
CAT 1.12 For each trip that has more than one guide that can lead the trip, list the trip name,
The trip type, and the first and last names of each guide.
Datasheet views
Design/QBE View & SQL View
4
1/20/2016
CAT 1.12 Multiple‐Guide Trips
Step 2 (w/ Step 1)
Step 1: Multiple Guides:
Datasheet View
Step 1: Multiple Guides: Query
Design View (QBE)
Step 2: Add Guides Names:
Datasheet View
Step 2: Add Guides in Seq. Query
Design View (QBE)
Join with
Saved
Query
CAT 1_12 SQL View
Final Solution – Microsoft SQL – Getting Under the Hood!!
• SELECT [CAT1‐12‐GT1].TripID, [CAT1‐12‐GT1].TripName,
[CAT1‐12‐GT1].Type, [CAT1‐12‐GT1].CountOfGuideNum AS
[Number], Guide.FirstName, Guide.LastName
• FROM (Guide INNER JOIN TripGuides ON Guide.GuideNum =
TripGuides.GuideNum)
• INNER JOIN [CAT1‐12‐GT1] ON TripGuides.TripID = [CAT1‐12‐
GT1].TripID;
5
1/20/2016
CAT 1_12 SQL View
Final Solution –
Standard SQL
• SELECT [CAT1‐12‐GT1].TripID, [CAT1‐12‐GT1].TripName, [CAT1‐12‐
GT1].Type, [CAT1‐12‐GT1].CountOfGuideNum AS [Number],
Guide.FirstName, Guide.LastName
• FROM [CAT1‐12‐GT1], Guide, TripGuides
• WHERE (Guide.GuideNum = TripGuides.GuideNum) AND
TripGuides.TripID = [CAT1‐12‐GT1].TripID;
ACCESS Tabbed Documents/Objects
Open File tab
• Starting with Office Access 2007 you
can display your database objects in
tabbed documents instead of
overlapping windows. For everyday
interactive use, you may prefer the
tabbed document interface.
• Show or hide document tabs
– Click the File tab, and then click Options.
– The Access Options dialog box aTALears.
6
1/20/2016
Access Option Dialog Box
Tabbed vs. Overlapping
Documents
• The Access Options dialog
box appears.
Access Option Dialog box
– In the left pane, click Current
Database.
– In the Application Options section,
under Document Window Options,
select Tabbed Documents.
– Select or clear the Display Document
Tabs check box. Clearing the check
box turns off document tabs.
– Click OK.
– Must Restart Access!
Display Document Tabs
vs. Overlapping Windows
•
Notes:
–
–
–
The Display Document Tabs setting is a
per‐database setting. You must set this
independently for each database.
After you change the Display Document
Tabs setting, you must close and reopen
your database to see the change take
effect.
New databases created by using Access
2007 or Access 2010 display document
tabs by default.
7
1/20/2016
CAT 1‐12 (Both Steps)
CAT 1‐12 SAMPLE QUESTION…For each trip that has more than one guide that can lead the trip,
list the trip name, The trip type, and the first and last names of each guide.
Datasheet view Step 1
Query Design/QBE View Step 1
Datasheet view Step 2
Query Design/QBE View Step 2
Join with
Saved
Query
STOP
8
Download