Upload
lydia-walsh
View
213
Download
1
Embed Size (px)
Citation preview
CPSC 203Introduction to Computers
T43, T46 & T68
By Jie (Jeff) Gao
15 February 2005 CPSC 203 Tutorials by Jie Gao 2
Introduction to Database
• What is a database?– A database is a collection of information
related to a particular subject or purpose.
• Why should we use databases?– Keep consistent information altogether– Easy to manage and find useful information– Easy to manage related information
15 February 2005 CPSC 203 Tutorials by Jie Gao 3
An Example
Dept Course Year Semester Students
CPSC 203 05 Winter 571
CPSC 231 04 Fall 187
CPSC 331 05 Fall 94
MATH 249 05 Winter 76
MATH 353 05 Winter 25
PHYS 225 04 Winter 129
15 February 2005 CPSC 203 Tutorials by Jie Gao 4
Terminology (1)
Table
Dept Course Year Semester Students
CPSC 203 05 Winter 571
CPSC 231 04 Fall 187
CPSC 331 05 Fall 94
MATH 249 05 Winter 76
MATH 353 05 Winter 25
PHYS 225 04 Winter 129
Field
Record
15 February 2005 CPSC 203 Tutorials by Jie Gao 5
Terminology (2)
• DBMS– Database Management System
• Database Objects in Access– Table– Query– Form– Report– Pages……
15 February 2005 CPSC 203 Tutorials by Jie Gao 6
Plan for the Lab
• Today– Basic operation in Access: create table, alter
table, input data, append or insert data, sort records, forms, …
• Thursday– Advanced operation in Access: queries,
reports, …– Assignment requirements
15 February 2005 CPSC 203 Tutorials by Jie Gao 7
Creating A Table
• Design table structure– Add fields– Select data type for fields– Set input mask for fields
• Set primary key
• Give the table a name
15 February 2005 CPSC 203 Tutorials by Jie Gao 8
Alter A Table
• Change in design view– Everything could be changed
• If delete a field, the data in that field will be deleted
15 February 2005 CPSC 203 Tutorials by Jie Gao 9
Edit Data
• Input data in datasheet view
• Move your cursor to different records using the navigator at the bottom of the datasheet view
• Use Tab or Shift+Tab keys to move your cursor to the next or previous field
15 February 2005 CPSC 203 Tutorials by Jie Gao 10
A Little More Work
• Sort– By a field– Ascending or descending
• Data in a table is automatically saved; the layout of a table’s data view should be saved manually
15 February 2005 CPSC 203 Tutorials by Jie Gao 11
Forms in Access
• A form in Access is used to provide a friendly interface to the user– With labels and input boxes to input and/or
view data
• The user can input data into a table through a form created on that table
• The user can also navigate data by using the form
15 February 2005 CPSC 203 Tutorials by Jie Gao 12
Create a Form
• Two methods: Wizard or Design View
• Form Wizard is easy to use. You can create a form for a table with simple steps
• Design View can provide you more power. You can implement advanced features!
15 February 2005 CPSC 203 Tutorials by Jie Gao 13
Form Wizard
• Select– Which fields will appear in the form
You can select fields from multiple tables– Form type (layout)– Style– Name
• You can click “Finish” when you accept the defaults for the following steps.
15 February 2005 CPSC 203 Tutorials by Jie Gao 14
Form Design View
• You can– Add controls to the form– Drag fields into the form– Adjust the form layout– Add header or footer– Even do something like programming
15 February 2005 CPSC 203 Tutorials by Jie Gao 15
Assignment 3
• Start with a blank database
• Create a table
• Create a form on that table
• Input data
• Create reports– Create queries when necessary
• Refer to the information on my web site