Download Slide 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
DAY 20:
MICROSOFT ACCESS – CHAPTER 3 CONTD.
Aliya Farheen
[email protected]
March 19, 2015.
ANNOUNCEMENT
• MyITLab Lesson D is due on 4/6/2015
Monday by 11:59 pm.
• Based on the Microsoft Word
• Consist of seven chapters
• Plan yourself to complete before due date.
REMINDER
• Homework # 4 in Microsoft Access is now available
at
http://cs101.wvu.edu/instructors/farheen/assignments/
• It is due by 4/3/2015 by 11.59 P.M.
• Will have a homework review session in the next
class.
TOTAL QUERIES
• “Totals” in a query can group field values
and also perform basic computational
functions on them
• To make the Total row appear, you need to
click the Sigma symbol “Totals” button in
query design view !
EXERCISE
• Go to the lecture notes page and Download
Total_example.accdb.
PREMISE
We are running an investment firm and have
some consultants working for us who have
clients for which they manage investments.
We want a query that will show us how many
clients each consultant has and the total
amount of investments each consultant is
handling…
• Save locally and open Total_example.accdb
STRUCTURE OF TABLES &
RELATIONSHIP
This Database has not yet had a relationship created. We will do it in the query for this
one. Sometimes under special circumstances you will create them here instead of in the
relationships window. Generally it is done in the relationships window though…
BUILDING THE TOTAL QUERY
• Create ribbon > Other group > Query
Design
• Add both tables
• Create relationship inside query by
dragging ConsultantID fields together
BUILDING THE TOTAL QUERY
•
•
•
•
Add the field [Consultants]LastName
Add the field [Clients]LastName
Add the field [Clients]Assets
Run it without Total options > back to design
view
• Click the
button on the Query Tools /
Design ribbon to insert a “Total:” row
• Note that the default for each is “Group By”
BUILDING THE TOTAL QUERY
• We will Group By the last name of the
consultants to show each of them
singularly
• We will Count the last names of the clients
as they are tied to the consultants to show
how many clients each has !
• We will Sum the assets of the clients to
show how much all clients of each
consultant have together
SETTING UP THE TOTAL ROW
• Have [Consultants] LastName as Group
By
• Have [Clients] LastName as Count
• Have Assets as Sum
• Run the Query
!
ALIASING THE FIELD NAMES
• Sometimes for a Field, a Calculated field,
or a Total field, we like to make the display
name more specific in the query results
• To do this, simply change the field name in
design view by adding a new name and an
“:”
• An example for the clients LastName field:
# of Clients: LastName
ALIAS THE 3 FIELDS IN DESIGN
VIEW
•
•
•
•
Consultant: LastName
# Clients: LastName
Total Assets: Assets
Run the Query and note the field names in
the dynaset !
DOING MULTIPLE THINGS TO 1
FIELD
• Sometimes you may need to do multiple
total query-type actions to a single field.
• Download and open the file
CSDemo.accdb from the site
BACKGROUND FOR TOTAL
QUERY
• Look at the contents of the Sales table
We want to display our:
• Number of sales
• Total dollar amount of sales
• Average dollar amount sale
CREATING THE TOTAL QUERY
•
•
•
•
•
Create a new query in design view
Add the Sales Table
Add the Amount field 3 Times ! ! !
Click
button to show the Total row
Set them to Count, Sum, and Average
• Run it !
• Close Access
IMPORTING XML DATA TO TABLES
• Download and save Bands.xml file on the
desktop
• External Data Ribbon > Import group > XML
File
• Browse for the xml file
• Select Open & OK
IMPORTING XML FILES
• Verify Structure and Data is checked
• This brings in the table & its records
• Later in the course we will use other options
• Click OK and Close
• Open the table in the database !
IN CLASS PROJECT
• Go to todays lecture notes
• Download the data file
Save the database file on to computer
• Collect the instruction file
• Start working on the Queries Project !