Create a Database Structure
Create a Database Structure
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
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
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
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
© 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
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
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
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
2 1 Ballroom 2024-02-13
3 3 Contemporary 2024-03-01
4 2 Street 2024-03-07
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
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:
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
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
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'
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
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
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
* - Represents all
© 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
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
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.
Page 19 of 19
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers