lesson 02:
DESCRIPTION
Lesson 02:. Creating Database. At the end of this lesson, students should be able to:. Save database file Create table by using wizard Differentiate field, record and table Define primary key Insert data in the table Save table Find record from table. Field 1 (numbers). - PowerPoint PPT PresentationTRANSCRIPT
Lesson 02:
Creating Database
• Save database file• Create table by using wizard• Differentiate field, record and table• Define primary key• Insert data in the table• Save table• Find record from table
At the end of this lesson, students should be able to:
For example, students profiles table as shown below. (Figure 1)
Creating Table
record 2
Field 1 (numbers)
Field 1 (name)
Field 1 (address)
Field 1 (icno)
Figure 1
1. Open MS Access 2003 software
Steps Creating Table
2. Click File, click Open, find students profiles database file then click Open button. (refer Figure 2)
Figure 2
3. Database window students profile: Database will appeared as shown below (Figure 3) then click New button at database windows toolbar. The dialog box in Figure 4 will appear.
Figure 3
4. Click Design View , then click OK to get Datasheet view as shown at Figure 5.
Figure 4
Figure 5
Design View
5. At Field Name column, type in numbers and at Data type column, change value Text to Number. (refer Figure 6)
Figure 6
Click this button to view the list of data type, then click number
6. There are 10 types of data as stated in the table below:
Types Data FunctionText You may type in any
alphabetical/numerical data that you desire-up to a maximum of 255 characters. As indicated, this is a text field, so you can't do mathematical calculations. Examples of Text data are: names, addresses, stock numbers, room numbers, zip codes, etc
Memo This field is for lots of text. You can have up to 32,000 characters.
Number This field is for numbers where you want to add, subtract,multiply, divide, average, and do
numerical calculations .This field can be a very large size, so when we get toField Properties, we'll talk about "sizing" this field so it doesn't take up too much "space" in storage.
Types Data Function
Date/Time Dates and Times. You may format this later, as you maydesire.
Currency Dollar ($). You may format this later, as you may desire. For example Ringgit Malaysia (RM)
AutoNumber This field is an "automatic" counter that assigns a number each time you put data into a new field.
7. There are 10 types of data as stated in the table below:
Types Data Function
OLE Object This means "Object Link Embedding" which indicates you can insert a graphic, picture, sound, etc. Pretty neat to put a photograph in a personnel record or a picture of an inventory item in the stock record (advanced stuff).
Hyperlink A hyperlink is a pointer from one object to another. The destination is frequently another Web page, but it can also be a picture, an e-mail address, a file (such as a multimedia file or Microsoft Office document), or a program. The hyperlink itself can be displayed as text or as a picture.
Lookup Wizard
This wizard creates a lookup column, which displays a list of values you can choose from.
8. Insert data in the Field Name, Data Types for each fields as displays (Figure 7). Students can move to the next column by press “Tab key”.
Figure 7
Place the cursor at address
Change Field Size value to 100
Figure 8
9.Click numbers at field name column, click at Edit menu bar, then click
10. Primary Key or icon Primary Key . Shown at Figure 9. Primary key icon
Figure 9
close icon
11. Click Close icon as shown at figure 8 to close the creating table session. Then dialog box in figure 9 displayed.
12.Click Yes. Dialog box Save As in figure 10 displayed
Figure 10
Figure 11
Key in table name here
13.Type students profile at Table Name and then click OK at dialog box as shown in figure 10. Now you had finished creating one table named “students pofile:database” as shown below. (Figure 12)
Figure 12
students profile table created
1. Click at Students Profile table then click open at database window toolbar. (Figure 13)
Inserting Data in the Table
Figure 13
2. Datasheet view Students Profile : Table as shown in Figure 14 displayed
3. Key in data at the students profile datasheet
Figure 14
4.At the first row, type number ‘1’ at numbers column. Then, Type name Abdul Rahman b. Idris at name column. Next, type address and ic number at address and icno column.
Figure 15
5. Insert all data in the table by repeating the same process above. As a result, students will get the table below
6. Click icon save to saving file. Students Profile table now contained five records
7. Click icon close to close the inserting data session
Figure 16
Add Records
1. Open Microsoft Access 2003
2. Click Open an Existing Database, then click file students profile and click OK.
3. In the database window, double click students profile in the Tables pane to open the table in Datasheet view, as shown in figure 17.
4. To add new record, click on icon New Record that can be seen at database toolbar or at the bottom of datasheet window. (refer Figure 17).
Figure 17
Icon New record
5. Add five more record as below. (refer table 1)name address icno
Alias b Mohamad No. 5, Jalan Desa Kayang 3, Desa kayang, 01000 Kangar.
950918-02-5533
Mohd Shahid b Mohd Som
No. 39, Taman Tapah, Jalan Pahang 35000 Tapah, Perak.
950912-05-5321
Noorul-Aini bt Ambak No 15, Jalan Limau Kasturi, 4/4A 40000 Shah Alam, Selangor.
950212-11-5678
Noor Asiah bt Zakaria Lot 2646, Kg Simpang Tiga, Bt 6 3/4, 53100 Gombak, Selangor
950402-04-5566
Fasitah bt. Mansor No. 36, Jln. Melati, Tmn. Mewah, 31000 Batu Gajah, Perak
950606-03-5432
Table 1
6. Save record.
7. Close students profile : Table.
Add FieldsMethod 1: Add field after the last field.
1. Click Design button at database toolbar windows Students Profile: Database, to display all the fields.
2. Click field below icno (refer Figure 18)
3. Type in email inside the Field Name and select text as the Data Type.
Figure 18
4. Save the record
Add FieldsMethod 1: Add field after the last field.
1. Click Design button at database toolbar windows Students Profile: Database, to display all the fields.
2. Click field below icno (refer Figure 19)
Figure 19
3. Save the record
Method 2: Add new field in between the
two fields
1. Click Design button at database toolbar windows Students Profile: Database, to display all the fields.
2. Click the address field ( the row will be highlight -refer Figure 20 )
3. Put cursor in between field name and field address.
4. Type in sex inside the blank Field Name and select text as the Data Type.(refer Figure 20)
Figure 20
3. Put cursor in between field name and field address.
4. Type in sex inside the blank Field Name and select text as the Data Type.(refer Figure 20)
5. Save students profile.
6. Click to close students profile : Table.
1. Open Students Profile table.
2. To edit record, click inside the selected field. (sex and email)
3. Insert in all the record for sex field and email field. (refer Table 2)
Edit Record.
numbers name sex address email
1 Abdul Rahman b. Idris male [email protected]
2 Johana bt. Muhammad female [email protected]
3 Faridah bt Abdullah Female [email protected]
4 Rosnani bt. Sembok Female [email protected]
5 Hassan b. Wahid Male [email protected]
6 Alias b Mohamad Male [email protected]
7 Mohd Shahid b Mohd Som Male [email protected]
8 Noorul-Aini bt Ambak Female [email protected]
9 Noor Asiah bt Zakaria Female [email protected]
10 Fasitah bt. Mansor female [email protected]
Table 2
3. Repeat step 2 above to add in 5 postcodes (see bold figure) inside the first five record. (Refer Table 3).
Numbers Name Sex Address
1 Abdul Rahman b. Idris male 2304, Rumah Rumah Tasek Gelugor, 13300 Pulau Pinang
2 Johana bt. Muhammad sxsMMMuhammad female No 24, Jln 1, Taman Seri Sinar, 50600 Kulal
Lumpur
3 Faridah bt Abdullah Female No 39, Jln Pinang Merah 11, 81000 Bandar Tengg, Johor
4 Rosnani bt. Sembok Female No 1005, Kuala Terengganu, Terengganu
5 Hassan b. Wahid Choong Fook Keong Male No 101, Taman Kelang, Selangor
Table 3
Finding Record From Table1. Click field name as shown in Figure 21.
Figure 21
Icon Find
2. Click icon Find (refer Figure 21) and dialog box Find and Replace will be display as below (Figure 22).
Figure 22
3. Type in Noor* inside box Find What to find all the name starting with Noor.
4. Click Find Next button. Name Noorul-Aini bt Ambak will be highlighted at name field (refer figure 23).
Figure 23
5. Click Find Next button to find similar name with Noor. Name Noor Asiah bt Zakaria will be highlighted.
6. You can repeat step 3 to find other record.
7. Click File and Close to end this session.