Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
-
Upload
isabel-turner -
Category
Documents
-
view
216 -
download
0
Transcript of Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Microsoft Office XP Microsoft Office XP Illustrated Introductory, EnhancedIllustrated Introductory, Enhanced
Tables and QueriesTables and QueriesUsingUsing
2Using Tables and Queries Unit B
Plan a databasePlan a database Create a tableCreate a table Modify a tableModify a table Format a datasheetFormat a datasheet Understand sorting, filtering, and Understand sorting, filtering, and
findingfinding
ObjectivesObjectives
3Using Tables and Queries Unit B
Sort records and find dataSort records and find data Filter recordsFilter records Create a queryCreate a query Modify a queryModify a query
ObjectivesObjectives
4Using Tables and Queries Unit B
Planning a DatabasePlanning a Database
The most important object in a The most important object in a database is the table object.database is the table object.– Tables store the Tables store the raw dataraw data, the individual , the individual
pieces of information stored in fieldspieces of information stored in fields• When designing a table, the fields of When designing a table, the fields of
information and the type of data are information and the type of data are identifiedidentified
• Some databases have multiple tables Some databases have multiple tables linked togetherlinked together
5Using Tables and Queries Unit B
Planning a Database (cont.)Planning a Database (cont.)
Important planning items.Important planning items.– Determine purpose of databaseDetermine purpose of database– Determine what reports need to be Determine what reports need to be
producedproduced– Collect raw dataCollect raw data– Sketch the structure of each tableSketch the structure of each table
• The The data typedata type determines what type of determines what type of information you can enter in a fieldinformation you can enter in a field
6Using Tables and Queries Unit B
Planning a Database (cont.)Planning a Database (cont.)
Data types
7Using Tables and Queries Unit B
Planning a Database (cont.)Planning a Database (cont.)
Example of a database structure
8Using Tables and Queries Unit B
Planning a Database (cont.)Planning a Database (cont.)
Choosing between the Text and Choosing between the Text and Number data type.Number data type.– Avoid selecting the Number data type Avoid selecting the Number data type
for a telephone number or zip code fieldfor a telephone number or zip code field• Use the Text data typeUse the Text data type• Enter a phone number with letters, such Enter a phone number with letters, such
as a 800 numberas a 800 number• Able to sort zip codes alphabeticallyAble to sort zip codes alphabetically
9Using Tables and Queries Unit B
Creating a TableCreating a Table
Methods for creating a table.Methods for creating a table.– Import a table from another data source, such Import a table from another data source, such
as a spreadsheetas a spreadsheet– Use the Use the Table WizardTable Wizard to create a table from to create a table from
scratchscratch• Provides interactive steps to create field names Provides interactive steps to create field names
and data typesand data types
Sample tables
Sample fields
10Using Tables and Queries Unit B
Creating a Table (cont.)Creating a Table (cont.)
Key symbol, which
identifies a primary key
A primary key is a special
field that has unique
information
11Using Tables and Queries Unit B
Modifying a TableModifying a Table
Each database object has a Each database object has a Design Design ViewView to modify its structure. to modify its structure.– In the Design view of a table, you can In the Design view of a table, you can
add or delete fields, change field add or delete fields, change field properties, and add properties, and add field descriptionsfield descriptions
– Field Field propertiesproperties are additional are additional characteristics of a field such as its size characteristics of a field such as its size or default valueor default value
12Using Tables and Queries Unit B
Modifying a Table (cont.)Modifying a Table (cont.)
Data type column Field description
Symbol identifies
selected field
Field Properties
pane
13Using Tables and Queries Unit B
Modifying a Table (cont.)Modifying a Table (cont.)
Learning about field properties.Learning about field properties.– Properties are the characteristics that Properties are the characteristics that
define the fielddefine the field– Two properties are required for each Two properties are required for each
field: Field Name and Data Typefield: Field Name and Data Type• Other properties include: Field Size, Other properties include: Field Size,
Format, Caption, and Default ValueFormat, Caption, and Default Value
– Adding more properties to a field Adding more properties to a field restricts the type and amount of data restricts the type and amount of data which increases data entry accuracywhich increases data entry accuracy
14Using Tables and Queries Unit B
Modifying a Table (cont.)Modifying a Table (cont.)
Learning about field properties (cont.)Learning about field properties (cont.)– The The CaptionCaption property is used to property is used to
override the field names with an easy-override the field names with an easy-to-read caption on datasheets, forms, to-read caption on datasheets, forms, and reportsand reports
– Access Wizards create tables that have Access Wizards create tables that have field names without spacesfield names without spaces
15Using Tables and Queries Unit B
Formatting a DatasheetFormatting a Datasheet
Dramatically change the appearance Dramatically change the appearance of a datasheet.of a datasheet.– Change fonts, colors, and gridlinesChange fonts, colors, and gridlines
Formatted table
16Using Tables and Queries Unit B
Understanding Sorting, Understanding Sorting, Filtering, and FindingFiltering, and Finding
Datasheet records are automatically Datasheet records are automatically sorted according to the data in the sorted according to the data in the primary key field.primary key field.– SortingSorting is reorganizing records in either is reorganizing records in either
an ascending or descending order an ascending or descending order based on the contents of a fieldbased on the contents of a field
– FilteringFiltering is temporarily isolating a is temporarily isolating a subset of recordssubset of records
– FindingFinding is locating a specific piece of is locating a specific piece of datadata
17Using Tables and Queries Unit B
Understanding Sorting, Understanding Sorting, Filtering, and Finding (cont.)Filtering, and Finding (cont.)
Sort, Filter, and Find buttons
18Using Tables and Queries Unit B
Understanding Sorting, Understanding Sorting, Filtering, and Finding (cont.)Filtering, and Finding (cont.)
Records sorted in ascending order
19Using Tables and Queries Unit B
Understanding Sorting, Understanding Sorting, Filtering, and Finding (cont.)Filtering, and Finding (cont.)
Sort Ascending button
Sort Descending button
Apply Filter or Remove Filter button
Filtered by Rock category
20Using Tables and Queries Unit B
Understanding Sorting, Understanding Sorting, Filtering, and Finding (cont.)Filtering, and Finding (cont.)
Using wildcards.Using wildcards.– WildcardsWildcards are symbols you use a are symbols you use a
substitutes for characters to locate data substitutes for characters to locate data that matches your Find criteriathat matches your Find criteria
– Wildcards include:Wildcards include:• The The asterisk (*)asterisk (*) represents any group of represents any group of
characterscharacters• The The question mark (?)question mark (?) represents any represents any
single charactersingle character• The The pound sign (#)pound sign (#) represents a single represents a single
digitdigit
21Using Tables and Queries Unit B
Sorting Records and Sorting Records and Finding DataFinding Data
Records are sorted in
ascending order by title
22Using Tables and Queries Unit B
Sorting Records and Sorting Records and Finding Data (cont.)Finding Data (cont.)
Search criteria
Find the search criteria anywhere in the field
Search direction
23Using Tables and Queries Unit B
Sorting Records and Sorting Records and Finding Data (cont.)Finding Data (cont.)
Using more than one sort field.Using more than one sort field.– Primary sort fieldPrimary sort field (last name) (last name)– Secondary sort fieldSecondary sort field is used to further is used to further
sort records when there is a tie in the sort records when there is a tie in the primary sort fieldprimary sort field
• For example, two of the same last name For example, two of the same last name (Smith)(Smith)
– Queries allow you to sort by more than Queries allow you to sort by more than one fieldone field
24Using Tables and Queries Unit B
Filtering RecordsFiltering Records
Filtering the datasheet temporarily Filtering the datasheet temporarily displays only those records that displays only those records that match criteria.match criteria.– CriteriaCriteria are rules limiting conditions you are rules limiting conditions you
setset– To filter for comparative data and to To filter for comparative data and to
specify more complex criteria you must specify more complex criteria you must use the Filter By Form featureuse the Filter By Form feature
• A comparison operator: A comparison operator: equal to or greater equal to or greater thanthan
25Using Tables and Queries Unit B
Filtering Records (cont.)Filtering Records (cont.)
Comparison operators
26Using Tables and Queries Unit B
Filtering Records (cont.)Filtering Records (cont.)
Both records match the criteria
Filter By Form button
Filter By Selection button
27Using Tables and Queries Unit B
Filtering Records (cont.)Filtering Records (cont.)
Searching for blank fields.Searching for blank fields.– The The 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
– The The Is Not NullIs Not Null criteria will find all criteria will find all records where there is any entry in the records where there is any entry in the field, even if the entry is 0field, even if the entry is 0
– Primary key fields cannot have a null Primary key fields cannot have a null entryentry
28Using Tables and Queries Unit B
Creating a QueryCreating a Query
A A queryquery is a database object that is a database object that creates a datasheet of specified creates a datasheet of specified fields and records from one or more fields and records from one or more tables.tables.– A query is like a filter but can be saved A query is like a filter but can be saved
as a separate object unlike a filteras a separate object unlike a filter– A query answers a question about the A query answers a question about the
data in your databasedata in your database– A query is sometimes called a A query is sometimes called a logical logical
viewview of the data of the data
29Using Tables and Queries Unit B
Creating a Query (cont.)Creating a Query (cont.)
Editing data in a query.Editing data in a query.– Changes the data in the underlying Changes the data in the underlying
table just as if you were working directly table just as if you were working directly in the table’s datasheet.in the table’s datasheet.
– A query does not produce a duplicate A query does not produce a duplicate set of dataset of data
– A query displays the original table’s A query displays the original table’s data in a new arrangementdata in a new arrangement
30Using Tables and Queries Unit B
Creating a Query (cont.)Creating a Query (cont.)
Design View button
Query datasheet
31Using Tables and Queries Unit B
Creating a Query (cont.)Creating a Query (cont.)
Datasheet View button
Field list for query
Query design grid
Criteria cell for Category field
32Using Tables and Queries Unit B
Creating a Query (cont.)Creating a Query (cont.)
Queries vs. filters
33Using Tables and Queries Unit B
Modifying a QueryModifying a Query
Use Query Design View to modify a Use Query Design View to modify a query.query.– Define complex criteria, define multiple Define complex criteria, define multiple
sort orders, and build calculation fieldssort orders, and build calculation fields– To add fields to the query, drag the field To add fields to the query, drag the field
from the filed list to the open position in from the filed list to the open position in the query design gridthe query design grid
– Sort orders are evaluated from left to Sort orders are evaluated from left to rightright
34Using Tables and Queries Unit B
Modifying a Query (cont.)Modifying a Query (cont.)
Drag fields from the Field
list…
…and drop them in the query design grid
35Using Tables and Queries Unit B
Modifying a Query (cont.)Modifying a Query (cont.)
Understanding And and Or criteria.Understanding And and Or criteria.– Criteria placed on different rows of the Criteria placed on different rows of the
query design grid are query design grid are Or criteriaOr criteria• A record may be true for either row of A record may be true for either row of
criteriacriteria
– Additional criteria in the same row in Additional criteria in the same row in the query design grid is the query design grid is And criteriaAnd criteria
• Records must meet the criteria for all of Records must meet the criteria for all of the criteria on one rowthe criteria on one row