Upload
lambert-obrien
View
212
Download
0
Embed Size (px)
Citation preview
Microsoft AccessDesigning and creating tables and populating data
OverviewWe will look at planning and designing tables in a Microsoft Access database, how to apply formatting to those tables and how to import data from various sources into those tables.
Goals
By the end of the class, you will be able to:
Understand the benefits of using a database (vs. spreadsheet)
Identify the purpose of your database
Plan the design of your database
Create tables and assign suitable properties to each field
Import or enter data from various sources into Access tables
Understand the purpose of a Primary Key
Identify and understand the importance of data relationships
Understand the benefits of using a database (vs.
spreadsheet)
In both applications you may:• sort and filter data
• enter sophisticated calculations to derive further information• generate reports in multiple formats
• use forms to enter data, mail-merge data to mass produce individualized mailing
• connect to external data without importing• import data from other file formats• set user permissions
• protect your files with passwords
Access vs. ExcelExcel
Excel files have a flat structure
the information is in a self-contained list called a worksheet or workbook (several lists)
the data can be linked to other Excel worksheets or workbooks, but it is not easily tied together
Excel is an excellent tool for analyzing data, producing reports, charts and graphs
Most people are familiar with it to a greater or lesser extent.
Access
Access has a relational structure
Tables contain different data, but there are fields that have something in common fields in other tables.
Good for storing large amounts of data
Users can easily run queries from that data
Creating reports can be cumbersome in Access, however, if they are to be utilized on a regular basis, it’s worth investing the time to create them
It may be easier to export data to Excel for analysis
Identify the purpose of your database
Purpose Statement
Create a purpose statement:
The student database will store information about grades, attendance, discipline, special populations, TAKS, STAAR, Edusoft, college readiness and STAR reading. This information will be used by teachers to address the individual needs of each student and plan lessons accordingly.
HELP, HOW AM I GOING TO DO THIS?
Who will use this database?
What will I do with this information?
When will I use this?
Where do I get this data and how often is it updated?
Why do I need to track this data?
How will this data be used?
Plan the design of your database
The importance of planning your database cannot be underestimated. All of a sudden you have this new found tool that allows you to pull data easily and in a more meaningful format. You can dive straight in and start building ad hoc queries and adding multiple tables, but soon you will have so many queries or
tables that you cannot find what you are looking for, so you create more adding to the problem.
Look at the data you have and ask:
What format is the data in?
How much of this is duplicated?
What data is unique?
What reports or mailings do you want to produce?
What data do you need?
File FormatsAccess allows you to import data in these file formats:
Access
Excel
CSV
Delimited Text
ODBC
XML
dBase.
In some instances it may be easier to import data into Excel and manipulate it into a format that will make it more user-friendly in Access.
Things to RememberIf data is duplicated it affects how it is handled in
Access.
Unique fields could be ID numbers, social security numbers, or email addresses these always relate to one item as opposed to names which may be the same for several people in your database.
What do you want to get from the data, are you producing reports or mailings? What information do these need to contain?
What data do you actually need?
Create tables and assign suitable properties to each
field
Access field properties or data types
Group your data by subject
Use meaningful naming conventions that relate to that subject
e.g. Student rosters from the Pinnacle Grades report, you may choose the naming convention “Pinnacle_Grades_Student_Roster”,
This helps you to identify the source of the data and will be useful for future imports when you overwrite tables and need to know which report goes in which table.
Naming conventions in fields (columns)
It’s best not to have spaces in field names this can make it difficult if you choose utilize other components in Access such as Expressions and Visual Basic.
Use naming conventions that either replace spaces with an underscore or eliminate spaces and capitalize the first letter of each word. e.g “Student_Name” or “StudentName”.
FYI: In Access you do not need to worry about row names, rows are populated as data is entered in your fields.
Fields that have a relationship with a field in another table MUST have the same properties assigned.
Characters to avoid in field names
Spaces
Periods (.)
Colons (:)
Ampersands (&)
Forward slashes (/)
Dashes (-)
Asterisks (*)
Question marks (?)
Semicolons (;)
Double quotes (")
Colons (:)
Single quotes (')
Exclamation points (!)
Dollar signs ($)
Pound signs (#)
Percent signs (%)
Understand the purpose of a Primary Key
A primary key is a field, or a combination of fields, with a value that makes each record – each row in a table – unique.
Primary KeyEstablish the fields that make your records unique
Student ID
Social Security Number
Teacher ID
Choose these as you primary keys
Identify and understand the importance of data
relationships All tables must have at least one field that has a relationship with
another field in a different table
This is why Access is a relational database!
Plan your foreign keysA foreign key shares data with a primary key in
another table
Linking these two fields is called a relationship
Relationships will make more sense when you start building queries, for now you just need to know which data matches