Database Task

advertisement
Database Task
(View this file in Normal.)
Read the text about: Database in MS-Excel and then answer these questions.
The actual task-to-do is below these questions.
Questions:
1. What do the following terms mean in reference to a database?
Field Name:
Record:
Database:
Criteria:
2. How many rows in the database does the field name occupy?
3. How do you add the AutoFilter to a database?
4. Using the AutoFilter in MS-Excel to search the Cal Poly database, what would you
enter to obtain a list of all Kinesiology and Biology students?
5. What does the AutoFilter have to do with database formulas?
6. How does DCOUNT differ from DCOUNTA?
7. What goes on each line of the database formula?
= ________ ( _______ , _______ , _______ )
8. Is it necessary to have all of the field names from the database in the criteria section?
9. When using database formulas, how do you change the criteria section to include:
a. Bio or ENGL majors?
b. Pushup scores between 20 and 50?
Most of the answers are at the end.
__________________________________________________________________
Task to Do:
• Open MS-Excel (you may want to keep this Word file open too), and then open an
Excel file called: "database.xls" that is in this Task folder.
To the "database.xls" file:
• Shrink the columns of information to minimum width so that all of the information still
appears on the screen. Know various ways to change the width of a column, especially
using the pull down: Format  Column  Autofit…
• Use column A to number the records from 1 to n; then shrink Column A to Minimum
width.
AutoFilter
AutoFilter can be used to “extract” specific information from a large database. These
extracted lists can then be copied and pasted into a MS-Word file. Once in MS-Word,
these new files can be data files for a merge letter. Practice doing this.
• Use the AutoFilter... to:
- look for any apparent typing errors and then correct the error
• Hint use the AutoFilter on the Gender column, notice the typing error!
• Use the AutoFilter  Custom Filter….to:
• Notice the different comparisons that are available; such as: equals, is less than,
begins with, etc.
- Find all males who scored greater that 20 push-ups
- Find everyone who has a last name of Smith
- Use the “equals” and find everyone name that starts with "s" Add an asterisk and
see what happens: “s*”
• The asterisk is called a wild card and can be used to such uses as:
proct*r
sm*th
- Find all kinesiology majors who scored between 20 and 40 push-ups
• Copy and paste this list of kinesiology majors to MS-Word
• Start a merge letter in MS-Word and use this table as the merge data file.
Using an Excel file as a Merge Data File
Merge also allows a data file to be an Excel file. In other words, if you have an Excel file
with all the necessary data for your merge document, you did not have to copy and paste
the data from the Excel file to a MS-Word file. Practice this by making another merge
letter but this time use the Excel file as the data file. See the rules below about column
names in merge. Note: the newer MS-Word version will automatically change a space in
the name to an under score (i.e. push ups to push_ups).
•• Merge is more particular than database in regards to the rules for naming fields
(column names). The column names in merge must follow these rules:
• There can be no additional rows above the row of field (column) names
• The column names can only occupy one row
• No spaces in column names (exception now)
• No special characters in the column name
• Cannot start a column name with a number
• To save yourself future possible problems it is best to ALWAYS follow these
rules when naming fields in database too!
After doing all of the above with the AutoFilter in MS-Excel, you should be able to do:
• Copy and paste selected records from a database to a new worksheet (in the same
workbook)
• Copy and paste selected records from a database to a new workbook (that means a
new Excel file)
• Copy and paste selected records from a database to a Word document. Be careful of
the linking feature. It is easiest for the beginner to not link these files.
Database
Use the same "database.xls" file.
• Make a "criteria section" on the Excel worksheet to be used with the database formulas.
Place this several rows below the database, remember to leave several empty rows
(about 5) for the criteria section.
• Include the correct database formulas to do the following. Below is what should be on
the Excel worksheet. Can this table be copied and pasted to Excel?
Count
Percent
Average Pushups
Average Hours Exercised
Make the appropriate database formulas (which also means a criteria section) to complete
the following table. Then complete the table below which is in MS-Word. Have two
decimal places for all data except the count (no decimals). Notice the tabs that are used
to line-up the decimal places in the table. Notice that the table was made using tabs.
Table 1
Descriptive Statistics on Strength Tests for Kinesiology Majors
Males
Count
Percent
Average Push-ups
Average hours exercised
Females
Total
These last few tasks are a bit more difficult and will show an understanding of using
multiple criteria to search for both “and” and “or” conditions. Use the database formulas
(will have to change the criteria section) to answer these questions. Do not use the
AutoFilter.
• What is the mean, minimum and maximum hours exercised for all those born in 1953,
54, and 55? .. for just female? … for just males?
• How many people did between 20 and 40 pushups? How many were females and how
many were males?
__________________________________________________________________
Extra
When printing in Excel, know how to do the following:
• Be able to print lengthwise (landscape).
• Be able to specify the exact area on the worksheet that you want to print.
• Have the names and student number (usually columns A & B) printed on each page.
• Also know how to print the headings (i.e. rows 1-3) on each page.
NOTE: You may not be able to do all of this in the PE Mac Lab.; but at home, pull down
FILE – Page Setup… and see the various options available.
Answers:
1. What do the following terms mean in reference to a database?
Field Name:
think of these as the column names
Record:
these are the rows in the database
Database:
includes the field name and all of the records
Criteria:
this is only used with the database formulas
2. How many rows in the database does the field name occupy?
ANS: Can only be one row.
3. How do you add the AutoFilter to a database?
ANS: pull down: Data  Filter  AutoFilter
4. Using the AutoFilter in MS-Excel to search the Cal Poly database, what would you
enter to obtain a list of all Kinesiology and Biology students?
ANS: Use the Custom filter: Equal Kine Or Equal Bio
Why does AND not work (ANS: the AND would require a double major)
5. What does the AutoFilter have to do with database formulas?
ANS: Nothing. They are independent operations of each other. They each do different
things.
6. How does DCOUNT differ from DCOUNTA?
ANS:
DCOUNT is used with columns of numeric data (on non-numeric).
DCOUNTA is used with columns of non-numeric data.
7. What goes on each line of the database formula?
= ________ ( _______ , _______ , _______ )
ANS:
= database function name (the array of the complete database including field
names, the cell location of field name , the array of the criteria section )
8. Is it necessary to have all of the field names in the criteria section?
ANS: NO If you are just interested in screening the database on Gender, then you only
need to have Gender in the criteria section.
9. How do you change the criteria section to include?
a. Both Biology and English?
Major
Bio
Engl
b. Pushup scores between 20 and 50?
pushup
pushup
>=20
<=50
** However, in both instances the "criteria" portion of the database formula must
match.
REVIEW: using Functions
- this has nothing to do with database
Copy and paste the following table to MS-Excel. Note: if you do not like the way the
cells look in Excel; (1) resize the rows and columns (the AutoFit may not work); and (2)
eliminate any border that may appear around the cells.
On the Excel file, complete the following functions for "pushup" and "exercised." Note,
do not use database functions.
pushup
Number of workout
hours per week
exercised
19
20
35
40
25
18
20
25
30
26
19
30
40
TOTAL
Mean
Std Dev
Minimum
Maximum
30
35
21
10
10
15
13
12
9
10
15
Download