Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Chapter 18 – Data Manipulation

What is Database?
A database is an organized collection of data. Database allows users to store, organize and search
data, as well as outputting it in either a printed or electronic format.

• Field / Data → is a single item of data in a table.


o Data types
1. Text / Alphanumeric
2. Number
3. Currency
4. Date/Time
5. Boolean
• Record / row → is a collection of fields.
• File / Table → is an organized collection of records.
o Flat-file database
o Relational database
• Field name / Information

Database file structure → Table structure


Database practical
DBMS (Database Management System Software)
• MS Access → *.accdb

Data types
1. Text /Alphanumeric → [a-zA-Z] [0~9] !@#$%^&*()_+
• Phone number → text data type
i. Start with zero
ii. No calculation
iii. It contains alphanumeric
2. Numeric/Number (integer, double) → 0 1 2 3 4 5 6 7 8 9
• Can perform calculation
• Only year value → 2021
• Only month value → 12
• Only day value → 14
3. Currency → UK Format
• Pound £ → £2.00
• 2 decimal places
4. Date/Time → UK format → Day Month Year
• DMY → 11/12/2021 | 14/12/2021
• UK → 11 Dec 2021 | 14 Dec 2021
• US → 12 Nov 2021 | error
5. Boolean / Logical
• Yes | No
• True | False
• On | Off
• Check box on | check box off
• -1 | 0
Flat-file database → cars.accdb
- A flat-file database stores its data in one table.

Relational database → high school.accdb


- A relational database stores data in more than one linked table, stored in a file.

Database object files


1. Table
2. Form
3. Query
4. Report

Practical Tasks
1. Table object file
• Create/ import table
• Field name rules
• Should not contain (space, symbol → !@#$^&*()+?/)
• Do not start with number
• Choosing Data type
• Data formatting
• Primary key field
• A primary key field that holds unique data and is the field used to identify that
record.
• Choose primary key field
1. Unique (no duplicate data)
2. No empty (data must have)
• PK properties
1. Represent the record / Identify
2. Table relationship / table link
• Foreign Key Field
• A foreign key in one table will point to a primary key in another table.
• Table relationship
• One to many
2. Form → Form Wizard
• Create form
• Format form
• Design View
1. Adjust width & height to all text-boxes. Left aligned.
2. Bold, Black and Right align to the labels. Descriptive.
3. Bold, Black the form title.
4. Combo-box = Dropdown box
a. Row source type
i. Table/Query
ii. Value list
5. Date time box
6. Option button/ Radio button
7. Buttons
a. Navigation button → Fast, Previous, Next, Last
b. Action button → New, Save, Delete
• Perform data entry → save


3. Query → Query Design
• Logical
• AND → same row different columns
• OR → different rows (use OR keyword)
• NOT → expect
• Wildcard search (have, contain, include)
• * → any character/ any quantity
• ? → any character/ one quantity
• Like “*Alloy wheels*” → contain, have, include
• T* → start with
• *s → end with
• B* → blue, black, brown
• B??? → blue
• B???? → black, brown
• Relational/ Comparison operators
• = → Equal
• <> → Not equal
• <→Less than
• <=→Less than or equal
• >→ Greater than
• >= → Greater than or equal
• Between 5000 and 10000 (>=5000 And <=10000)
• Formula
• +, - , *, /
• Summary query → Query Wizard
4. Report & Label
• Create Report → Report Wizard
• Report Formatting
• Design View
1. Remove date and page placeholders
2. Bold, black to all labels and report title
• Layout View
1. Page size A4
2. Ctrl + a → borders
3. Adjust order of fieldnames
4. Adjust width & height of all fieldnames
5. Ctrl + a → remove borders
• Design View
1. Adding texts (subtitle, student info)
2. Formula → report footer
a. =Sum([field name])
b. =Avg([field name])
c. =Max([field name])
d. =Min([field name])
e. =Count([field name]) → count value
f. =Count(*) → count records
• Label
• Avery J8165 → 8 records per page
• Avery J8166 → 6 records per page
Practical files
• Cars.accdb → Flat-file database
o Cars table
• High School.accdb → Relational database
o Teachers table
o Students table
• Stationery.accdb → Activity
o Stationery table
o Customers table
o Orders table

You might also like