Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Create a Database Structure

Uploaded by

selimrashad88
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Create a Database Structure

Uploaded by

selimrashad88
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Head to www.savemyexams.

com for more awesome resources

Cambridge (CIE) IGCSE ICT Your notes

Create a Database Structure


Contents
Types of Database
Primary & Foreign Keys
Perform Calculations
Sorting & Searching Data
Form Design

Page 1 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Types of Database
Your notes
Types of databases
What is a database?
A Database is a structured, persistent collection of data
It allows easy storage, retrieval, and management of information
Electronic databases offer a number of key benefits:
Easier to add, delete, modify and update data
Data can be backed up and copied easier
Multiple users, from multiple locations, can access the same database at the same time
There are two main types of database
Flat file
Relational

Flat file database


A flat file database is one that stores all data in a single table
It is simple and easy to understand but causes data redundancy, inefficient storage and is harder to
maintain
Consider this example flat file table of students

Page 2 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Your notes

This table has redundant data - the tutor and form room information repeats, this is inefficient
If a tutor changed their name we would need to find all instances of that name and change them all
Missing any would mean the table had inconsistent data
Relational database
A relational database is one that organises data into multiple tables
It uses keys to connect related data which reduces data redundancy, makes efficient use of storage
and is easier to maintain
A relational database solves the issues in a flat file database:
A new table could be created to store the tutor information and the tutor information in the student
table could be moved to the new table
Then a foreign key in the student table (TutorID) could link a student to their tutor

Page 3 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Your notes

Now the name of each tutor and their form room is stored only once
This means if they change only one piece of data, the data is updated in the entire database and
inconsistency is avoided
Tables & records
What is a table?
A table is a complete set of records about the same subject/topic in a database
An example of a database table named cars is below
cars

Page 4 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

car_id make model colour price


Your notes
1 Peugeot 2008 Red 24950

2 Mazda MX5 Blue 17995

3 Citroen DS4 Black 21450

4 Ford Puma White 19500

What is a record?
A record is complete set of fields on a single entity in a table (row)
An example of a record in the cars table below is highlighted in green
cars

car_id make model colour price

1 Peugeot 2008 Red 24950

2 Mazda MX5 Blue 17995

3 Citroen DS4 Black 21450

4 Ford Puma White 19500

Page 5 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Primary & Foreign Keys


Your notes
Fields & data types
What is a field?
A field is a single piece of data in a table (column)
'Make' is an example of a field in the 'cars' table below
cars

car_id make model colour price

1 Peugeot 2008 Red 24950

2 Mazda MX5 Blue 17995

3 Citroen DS4 Black 21450

4 Ford Puma White 19500

What is a data type?


A data type is the type of data that can be held in a field and is defined when designing a table
Examples of common datatypes are:
Numeric - whole/decimal
Character/string - text data
Date/Time
Boolean - true or false values
In the car table above, the following datatypes would be used:
car_id: numeric
make: string
model: string
colour: string
Page 6 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

price: numeric
Primary Keys & Foreign Keys Your notes
What is a primary key?
A primary key is a unique field that can be used to identify a record in a table
order_id is the primary key for the orders table

customer_id is the primary key for the customers table

What is a foreign key?


A foreign key is a field in a table that refers to the primary key in another table.
A foreign key is used to link tables and create relationships
In the orders table customer_id is a foreign key - it links an order back to the customer that made the
order in the customer table

Page 7 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Key database terminology


Your notes
Term Definition

Table A collection of records with a similar structure

Record A group of related fields, representing one data entry

Field A single piece of data in a record

Data type Type of data held in a field

Primary A unique identifier for each record in a table. Usually an ID number


key

Foreign A field in a table that refers to the primary key in another table. Used to link tables and
key create relationships

WORKED EXAMPLE
A relational database has been developed for a dance club to store information about their
members and the styles of dance they practice.
The database contains two tables: Members and Styles
Figure A shows some data from the tables.
Members

MemberID FirstName LastName DateJoined

1 Zarmeen Hussain 2024-01-19

2 Fyn Ball 2024-02-01

3 George Johnson 2024-02-25

4 Ella Franks 2024-03-04

Styles

Page 8 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

StyleID MemberID Style DateStarted

1 1 Hip Hop 2024-01-22 Your notes

2 1 Ballroom 2024-02-13

3 3 Contemporary 2024-03-01

4 2 Street 2024-03-07

(a) State one benefit of using relational databases [1]


(b) State the name of the field from the Members table that is the most suitable to use as the primary
key [1]
(c) State the name of the field from the Styles table that is a foreign key [1]
Answers
(a) reduces data redundancy // reduces data inconsistency [1]
(b) MemberID [1]
(c) MemberID [1]
Guidance
Ignore case (for example: memberid)
No mark if inside quotation marks (for example: "MemberID")
No mark if there is an obvious space in response (Member ID)

Page 9 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Perform Calculations
Your notes
Perform calculations
How do you perform calculations in a database?
In a database, you can use arithmetic operations or numeric functions to perform calculations
Calculated fields are fields that carry out a calculation based on other number fields in the database
For example, a 'products' table with a stock and unit_price fields
You could use a calculated field named stockvalue to calculate unit_price * stock
This calculation multiplies the price of each item by its quantity to find the total value of the stock

Adding a calculated field to a database table

Calculated controls are objects you place on forms or reports to display the result of an expression
For example, a form in a sales database where you input the QuantitySold and UnitPrice
A calculated control could be used to display the TotalSale
TotalSale = QuantitySold * UnitPrice

Page 10 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

This displays the total sale on the form without storing it in the database
Using formulae and functions to perform calculations
Your notes
Databases allow you to use formulae and functions to perform calculations at run time
This can include basic arithmetic operations: addition, subtraction, multiplication, and division
For example, you have a discount field and you want to subtract it from the total cost, you could use a
subtraction operation like this:
FinalCost = TotalCost - Discount

Aggregate functions
You can also use aggregate functions to calculate statistical information about a set of records
Some examples include:

Sum Adds together all the numbers in a column SUM(TotalCost)

Average Computes the average of a set of numbers in a column AVERAGE(Price)

Maximum Finds the highest number in a column MAX(Price)

Minimum Finds the lowest number in a column MIN(Price)

Count Counts the number of rows in a column COUNT(ProductID)

Remember that the actual syntax and function names might differ slightly depending on the specific
database system being used.

Page 11 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Sorting & Searching Data


Your notes
Sorting
What is sorting?
Sorting is a crucial function in databases that helps organise and present data in a meaningful way

Using a single criterion to sort data


You can sort data based on a single criterion - such as by name, date, or numerical value
For example, you might sort a list of customers in ascending order by their last names
To sort the customer's table by LastName in either ascending or descending order:
Open the table in 'Datasheet View'
Click on the column header for the field to be sorted
For example, a table of customers to be sorted by LastName, click on the LastName column header
Click on the "Sort Ascending" or "Sort Descending" button in the toolbar at the top of the
screen

Sorting a table of information using only one criterion

Using multiple criteria to sort data


Page 12 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

You can also sort data based on multiple criteria


For instance, you might want to sort a list of customers first by LastName (ascending), and within each Your notes
LastName, by City (descending)

To sort the customer's table first by City, and then by LastName within each city:
Open the table in 'Datasheet View'
Click on the 'Advanced' button in the Sort & Filter section above
Select 'Advanced Filter/Sort'
Add the first column to sort data by, by dragging in to the QBE grid and from the sort row
choose ascending or descending
Repeat for second criteria
Selecting 'Advanced' again and choose 'Apply Filter/Sort'

Sorting a table of information using more than one criterion

Ascending and descending order


Ascending Order - Data is sorted from smallest to largest (e.g., from A to Z, or from 1 to 100)
Descending Order - Data is sorted from largest to smallest (e.g., from Z to A, or from 100 to 1)

Page 13 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Searching
Your notes
What is searching?
Searching is the process of using keywords, phrases or criteria to find specific information within a
database
Searching in databases is typically done using queries
Queries can be based on a single criterion or multiple criteria

Using a single criterion to select subsets of data


You can use a single criterion to select specific data
For example, you might want to select all customers from a specific county
E.g. to return all customers from Devon:
Open the 'Query Design View'
Add the table you want to query
Drag the field you want to query to the QBE grid
For instance, if you're looking for customers from a specific county, drag the County field
In the Criteria row under this field, type the value you're looking for (e.g., 'Devon')

Page 14 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Your notes

Creating a search within a database using one criterion

Using multiple criteria to select subsets of data


You can also use multiple criteria to select data
For instance, you might want to select all customers from a specific city who have also purchased in
the last month
E.g. to return all customers from London who purchased in the last 30 days:
Follow the steps above to start a new query and add the City field with 'London' as the criteria
Drag another field you want to query to the QBE grid
For example, if you're looking for customers who purchased in the last month, drag the
LastPurchaseDate field

In the Criteria row under this field, type Date()-30


Hit run

Using operators to perform searches


AND - Returns true if both conditions are met
OR - Returns true if at least one condition is met

Page 15 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

NOT - Returns true if the condition is not met


LIKE - Returns true if the value matches a pattern (used with wildcards) Your notes
>, <, =, >=, <=, <> - These are comparison operators, they return true if the comparison between the
values is correct
Using wildcards to perform searches
Wildcards are used with the LIKE operator to search for patterns
The most common wildcard characters are:
% - Represents zero, one, or multiple characters

_ - Represents a single character

* - Represents all

E.g. to return all customers whose names start with 'L':


Start a new query and drag the field you want to query to the QBE grid
For example, if you're looking for customers whose names start with 'L', drag the LastName field
In the Criteria row under this field, type L*
Hit run

Searching a database using a wildcard function


Page 16 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Form Design
Your notes
Form design
What is a database form?
Forms of a tool used to capture data to be stored in a database
Examples of forms include:
Online form to sign up to a website
Filling in personal details on a mobile device to join a gym
Database forms follow set design principles to ensure they include particular features

Characteristics of good form design


Simplicity - The design should be clean and straightforward, not cluttered
Ease of use - Users should be able to understand how to fill out the form quickly
Intuitive layout - Related fields should be grouped together, and the sequence of fields should follow
a logical order
Clear labels - Each field should have a clear, concise label indicating what information is expected
Appropriate controls - Use controls such as:
radio buttons
checkboxes
drop-down menus
Submit button
Save button
Next/previous records

Creating a Data Entry Form


You need to specify the fields required for data input
Choose the appropriate font styles and sizes. Aim for consistency and readability
Keep adequate spacing between fields for clarity and ease of use

Page 17 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

Your notes

Fine-Tuning Form Design


Appropriate Spacing
The spacing between individual characters in fields should be adjusted for readability
The use of white space is crucial - it improves readability and reduces cognitive load

Control Elements
Radio Buttons - Used when there is a list of two or more options that are mutually exclusive
Check Boxes - Used when the user can select multiple options from a list
Drop Down Menus - Used when you want to provide many options but conserve space

EXAM TIP
Always focus on simplicity and user-friendliness in form design
Make sure your form uses clear labels, logical field grouping, and intuitive sequence

WORKED EXAMPLE

Page 18 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources

A school is setting up a new computerised system to manage many aspects of the school
administration. The data from the registration system is saved in the school administration
database. The headteacher will need to check the attendance records for any student for any Your notes
semester. She will type in the Student_ID and the Semester (Autumn, Spring or Summer). After she
has done this the following data will appear on the same screen.

Field name

Student_name

Days_present

Number_of_lates

Number_absences

Parents_phone_number

Tutor_group

Design a suitable screen layout to display one record. It must have appropriate spacing for each
field, navigation aids and a space to type in search data.

Do not include examples of student data. [6]


Answer
Include 4 of:
Appropriate spacing for each field [1]
Forward/backward buttons [1]
Submit/search button [1]
Information attempts to fill the page AND the design looks appropriate to scenario [1]
Box/boxes to enter Semester or Student_ID [1]
Drop down for the Semester or Student_ID // radio button for semester [1]
Suitable title [1]
Instructions/help [1]
2 marks for all six fields
1 mark for three to five fields
0 marks for less than three fields

Page 19 of 19

© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

You might also like