You are on page 1of 8

COMPUTER SCIENCE

8
Fundamentals of Web
Application Development
Module 17 (Week 1)

Name of Student: Set (A or B):

Grade and Section: School Year: 2020-2021

Teacher: __________________ Date:


Lesson 4 Databases

 Starting Microsoft Access


 The MS Access Application Window
 Creating a Database
 Creating Tables
 Field Types

What is the use of Microsoft Access?

How to create a database in MS Access?

This chapter discusses the use of MS Access and the steps to create a database, tables,
setting the primary key and how to populate the data fields.

Page | 2
I. USING MICROSOFT ACCESS
Microsoft Access is a database management system that is part of the Microsoft Office suite. You
will use Microsoft Access to create your database for use in the next chapters. The database that
you will create will consist of tables. Each table is composed of fields, and each field will have its
specific data type. The data type determines what kind of data may be stored in a field.
A. Starting Microsoft Access
Click the START menu and select All Programs.

Click the Microsoft Office group and select Microsoft Office Access.
B. The Microsoft Access Application Window

Just like any Microsoft Office application, the Microsoft Access application has the title bar, menu
bar, standard toolbar, and taskpane.

 Title Bar – every program or application in Microsoft Windows is run inside a window. By
default, a window can be resized, moved, minimized, maximized, restored, and closed,
using the buttons found in the title bar. The title bar also contains the name of the window
that is used for identification when switching from one window to another, by either using
Alt+Tab or the taskbar.
 Menu Bar – the menu bar contains commands that can be used in the application. The
commands are grouped by category and are accessed by clicking it.
 Standard Toolbar – it contains the most common tasks that you would normally access
using the menu bar.

Page | 3
 Task Pane – it contains shortcuts to tasks that you normally access using the menu bar.
It also acts as an assistant in finding the answers to your questions.

C. Creating a Database
Creating a database involves the creation of a file with an extension of .mdb (Microsoft Database).
To create a new database, follow these steps:
1. Click File in the menu bar and select New.

2. Click Blank Database in the task pane.

3. Browse the folder where you want to save your database file, enter the filename, and click
Create.

In this example, students.mdb is used as filename for the database file. You should see the
Database Window afterwards.
You may use the Object Bar to browse the different objects in the database. In the meantime,
we will focus on tables.

Page | 4
D. Creating Tables
As mentioned earlier, a database is a collection of tables. In this example, we will use the entries
in the STUDENTS table found in Activity 2. To create a table, perform the steps below.
Step 1. Creating a table in design view
Double-click Create Table in Design view
You should see a window similar to the one below.

Step 2. Creating the fields of the table

Enter the following fields as they are shown below

The description part is optional but you may use it to describe the purpose of each field. Also,
take note that there is no space in the names of the field.
Review each field that you entered. You should be able to see the Field Size in the Field
Properties section. By default, it is set to 50 characters for text fields. Using a size more than what
is needed would mean that unnecessary storage space will be consumed. Since the setting is
more than what is required for each field, change the field size according to the recommendations
below.
- studnum: 7
- lastname: 30
- firstname: 30
- gender: 1
- section: 20

Page | 5
Step 3. Setting the primary key
When finished, right-click the button at the left of the studnum field and select Primary Key. This
will set the studnum field as the primary key of the table.

You should see a key displayed at the left of the studnum field.

Step 4. Saving the table


Click File in the menu bar and select Save to save the new table.

Enter students as the name of the table.

Click the Close button of the window (not the application window)
You should see the new table listed.

Page | 6
Step 5. Entering data.
Double-click students and enter the data as shown in the STUDENTS table in Activity 2.

Click the Close button of the window to end the data entry. There is no need to save. All entries
will be automatically saved to the disk.
You have now successfully created a table in Microsoft Access.
If you want to edit the structure of the table, just right-click the table name and select Design View.
E. Field Types

As you learned in Chapter 2, variable or data types are used to indicate the type of data being
stored. In designing tables, you may also specify the type of data that is to be stored in each of
the fields. The following are the some of the data types in Microsoft Access.

 Text – A text field can hold up to 255 characters. The content may be a combination of
alphabetic, numeric, or special characters.
 Memo – A text field that can hold up to 65,536 characters.
 Number – a number field can hold numeric values that can be used for calculations. You
may set the field size to indicate the type of number it will store. You may set the field size
using the following options:
o Byte – stores whole numbers from 0 to 255.
o Integer – stores whole numbers from -32,768 to 32,767.
o Long Integer – stores whole numbers from -2,147,483,648 to 2,147,483,647
o Decimal – stores decimal numbers from -10^28-1 to 10^28-1
o Single – stores decimal numbers from -1.79769314862318E308 to -4.9406564
 Autonumber – an autonumber field generates a number automatically. It is usually used
to create a record number to newly added records. An autonumber field is usually used
as the primary key in some tables.
 Currency – currency fields prevent values from being rounded off. It is accurate up to 15
digits to the left of the decimal point and up to 4 digits to the right.
 Yes/No – it stores a single value of either Yes or No (or True or False, or On or Off)
 Date/Time – stores date and time values.

You have to decide which of the field types is best suited for the data that you want stored in a
field. The idea is for you to make sure that the amount of storage space that will be allocated is
just right for your data.

Page | 7
COMPUTER SCIENCE 8 (MODULE 17)

Name: ____________________________________________ Date:


Teacher: __________________________________________ Grade & Section:

Write T if the statement is correct, otherwise F if it is incorrect.

1. Byte stores a stores whole numbers from 0 to 255.


2. Memo is a text field that can hold up to 65,536 characters
3. The title bar contains the name of the window that is used for identification when
switching from one window to another
4. The menu bar contains commands that can be used in the application.
5. Standard Toolbar contains the most common tasks that you would normally access
using the menu bar.

What is Microsoft Access?

What are the steps of making a blank database?

Exercise: Create a database named ‘tutordb.mdb’ and create a new table in design view and add
the following fields.
Field Name Data Type Field Properties
tutorID Autonumber Primary Key
title Short Text Field size 10
firstName Short Text Field size 50
lastName Short Text Field size 50
dateOfBirth Date//Time Format as short date

Switch to datasheet view and enter a new tutors. (Practice this activity on your own)

Page | 8

You might also like