Upload
randall-benson
View
217
Download
0
Embed Size (px)
Citation preview
Microsoft Access 2003 Microsoft Access 2003 Illustrated IntroductoryIllustrated Introductory
Using Tables and Using Tables and QueriesQueries
2Using Tables and Queries
Organize fieldsOrganize fields Plan related tablesPlan related tables Create a tableCreate a table Modify a tableModify a table Format a datasheetFormat a datasheet
ObjectivesObjectives
3Using Tables and Queries
ObjectivesObjectives
Understand sorting, filtering, and Understand sorting, filtering, and findingfinding
Sort records and find dataSort records and find data Filter recordsFilter records Create a queryCreate a query Modify a queryModify a query
4Using Tables and Queries
Organizing FieldsOrganizing Fields
Design the reports that you want the Design the reports that you want the database to producedatabase to produce
Collect the raw data that is required Collect the raw data that is required to produce the reportsto produce the reports
Identify a name and data type for Identify a name and data type for each fieldeach field
5Using Tables and Queries
Creating FieldsCreating Fields
Select a short but descriptive field Select a short but descriptive field namename
Select the appropriate data typeSelect the appropriate data type Add field descriptions and properties Add field descriptions and properties
as neededas needed
6Using Tables and Queries
Choosing the right Data TypeChoosing the right Data Type
Data Type: sample fieldsData Type: sample fields
TextText: FirstName, Zip, Phone: FirstName, Zip, Phone MemoMemo: Comment, Note: Comment, Note NumberNumber: Quantity, Units: Quantity, Units Date/TimeDate/Time: BirthDate : BirthDate
7Using Tables and Queries
Choosing the right Data TypeChoosing the right Data Type
Data Type: sample fieldsData Type: sample fields
CurrencyCurrency: Price, Tax: Price, Tax AutoNumberAutoNumber: CustomerID: CustomerID Yes/NoYes/No: Veteran, Exempt: Veteran, Exempt OLE ObjectOLE Object: Photo, Resume: Photo, Resume HyperlinkHyperlink: HomePage, Email: HomePage, Email
8Using Tables and Queries
Choosing between the Text Choosing between the Text and Number Data Typeand Number Data Type
Choose Text for Telephone, Choose Text for Telephone, ZipCode, etc. fields that contain ZipCode, etc. fields that contain numbers but do not represent numbers but do not represent numerical valuesnumerical values
Text preserves leading zeros such as Text preserves leading zeros such as a 01234 zip codea 01234 zip code
Text allows you to use the Input Text allows you to use the Input Mask property to control data entryMask property to control data entry
9Using Tables and Queries
Planning Related Tables Planning Related Tables
Separate the fields into specific Separate the fields into specific subject areassubject areas
Create sample records and examine Create sample records and examine the entriesthe entries
Identify a primary key field for each Identify a primary key field for each tabletable
Identify a common field to link tables Identify a common field to link tables in a one-to-many relationshipin a one-to-many relationship
10Using Tables and Queries
One-to-Many Relationship One-to-Many Relationship
1
many
11Using Tables and Queries
Planning Related Tables Planning Related Tables
The field on the “one” side of the The field on the “one” side of the relationship is usually the relationship is usually the primary primary keykey field for that table field for that table
The field on the “many” side of the The field on the “many” side of the relationship is called the relationship is called the foreign keyforeign key field for that tablefield for that table
12Using Tables and Queries
Creating a TableCreating a Table
Methods:Methods:
Database WizardDatabase Wizard Table WizardTable Wizard Table Design ViewTable Design View Importing dataImporting data
13Using Tables and Queries
Modifying a TableModifying a Table
Required Entries for a new field:Required Entries for a new field: Field NameField Name Data TypeData Type
Optional Entries for a new field:Optional Entries for a new field: DescriptionDescription Property ChangesProperty Changes
14Using Tables and Queries
Modifying a TableModifying a Table
Field Names Data Types
Properties
15Using Tables and Queries
Formatting a DatasheetFormatting a Datasheet
Formatting (Datasheet) Toolbar
Font
FontSize
Bold
Italic
Font/ForeColor
Line/BorderColor
Grid-lines
SpecialEffects
Underline Fill/BackColor
16Using Tables and Queries
Understanding Sorting,Understanding Sorting,Filtering, and FindingFiltering, and Finding
SortingSorting: : reorganizingreorganizing records in an records in an ascending or descending order based ascending or descending order based on a fieldon a field
FilteringFiltering: : isolatingisolating a subset of a subset of recordsrecords
FindingFinding: : locatinglocating a specific piece of a specific piece of datadata
17Using Tables and Queries
Sorting, Filtering, and FindingSorting, Filtering, and Finding
Table Datasheet Toolbar
SortAscending
SortDescending
Filter BySelection
Filter ByForm
Add orRemoveFilter
Find
18Using Tables and Queries
Find and Replace OptionsFind and Replace Options
Find WhatFind What Look InLook In MatchMatch SearchSearch Match CaseMatch Case
19Using Tables and Queries
WildcardsWildcards
Asterisk (*) = any group of charactersAsterisk (*) = any group of characters Question mark (?) = any single Question mark (?) = any single
charactercharacter Pound sign (#) = any single number Pound sign (#) = any single number
digitdigit
20Using Tables and Queries
Sorting RecordsSorting Records
Primary sort field Primary sort field Secondary sort fieldSecondary sort field Telephone book exampleTelephone book example
– LastName = Primary sort fieldLastName = Primary sort field– FirstName = Secondary sort fieldFirstName = Secondary sort field– Middle Initial = Third sort fieldMiddle Initial = Third sort field
21Using Tables and Queries
Finding DataFinding Data
Search Criterion
SearchOptions
Find and Replace dialog box
22Using Tables and Queries
Filtering DataFiltering Data
Apply Filter buttonClear Filter button
Wildcard asterisk character is used
Greater than or equal to operator is used
Filter by Form window
23Using Tables and Queries
Comparison OperatorsComparison Operators
24Using Tables and Queries
Searching for Blank fieldsSearching for Blank fields
Is NullIs Null criteria will find all records criteria will find all records where no entry has been made in the where no entry has been made in the fieldfield
Is Not NullIs Not Null criteria will find all criteria will find all records where there is any entry in records where there is any entry in the field, even if the entry is 0the field, even if the entry is 0
Primary key fields cannot have a null Primary key fields cannot have a null entryentry
25Using Tables and Queries
Creating a QueryCreating a Query
Methods:Methods:
Simple Query WizardSimple Query Wizard Query Design ViewQuery Design View
MethodsMethods
26Using Tables and Queries
Query Design ViewQuery Design View
Field Lists
Query grid identifies fieldsin query
Criteria to limit records
27Using Tables and Queries
Queries versus FiltersQueries versus Filters
28Using Tables and Queries
Modifying a QueryModifying a Query
Change sort ordersChange sort orders Add Add AND criteriaAND criteria (two criterion on (two criterion on
the same row)the same row) Add Add OR criteriaOR criteria (two criterion on (two criterion on
different rows)different rows) Add or remove fields from the query Add or remove fields from the query
gridgrid
29Using Tables and Queries
SummarySummary
Build tables to store dataBuild tables to store data Use Table Design View to define the Use Table Design View to define the
fields of your tablesfields of your tables Use table and query datasheets to Use table and query datasheets to
view, sort, filter, and find dataview, sort, filter, and find data Create queries to answer “questions” Create queries to answer “questions”
about your dataabout your data