Introduction to MS Access - San Francisco State University

Download Report

Transcript Introduction to MS Access - San Francisco State University

Introduction to MS Access
Creating a New Database
• File/New
– Blank database
– New database name and location
Access Objects
• Tables
– Create a new table: Create/Table Design
– Open a table:
• Double click the table name
– Home/View:
• Datasheet view
• Design view
• Queries
– Create a new query: Create/Query Design
• Others: Forms, Reports
Creating a Table
• Create/Table Design:
– Field name
– Field data type
• Don’t use the AutoNumber type
• Create a primary key
– Don’t use the default ID field for primary key.
Use a meaningful entity key field.
• Enter data
Example: Create an Employee
• Database name: HRdatabase
• Table name: Employee
• Table fields:
EmpID: Text, 10 characters
EmpName: Text, 30 characters
Sex: Text, 1 character
HireDate: DateTime field
Salary: Currency field
Create a new Query
• Create/Query design/Show table
– Select fields
– Add criteria
• Sorting
• Total and subtotal
– Query design tools/Total
– A Total row is added to the design view
– Select function from the total row’s dropdown list
File Organization and Access
• Sequential file (heap file): Records are
organized in sequence in the order in which
they are entered.
• File access:
– Sequential access
– Direct access
• Index file: Key + record’s location (address)
Major Functions of an Index
• 1. Enable the direct access to a record.
– Keep track a record’s location on disk.
• 2. Enforce the no-duplication rule for a
table’s key field.