G7_Unit 9_Data & Data Representation
G7_Unit 9_Data & Data Representation
Learning Objectives
Learners will learn to:
know that data is used to model scenarios within a range of industries,
<,>.
Vocabulary
database
primary key
query
Let Us Start
1
Let Us Explore
You have planned to start a library by collecting interesting books. You have
___________________________________________________________________________________
___________________________________________________________________________________
___________________________________________________________________________________
___________________________________________________________________________________
How will you search for books from a specific genre or author?
___________________________________________________________________________________
___________________________________________________________________________________
It becomes difficult to store and search a large amount of data as required for library
management. We need to use a database that allows us to easily store, manage and
Get, Set, Go
9.1 Data in a computer system
We know that data is any numbers, letters or symbols that can be entered into a
computer system. Some data items are A, 20, DOG, 3.1415927, ABC123, +++.
Data stored on a computer can be easily organised and sorted in different ways,
displayed or printed in various styles and layouts, searched for specific things,
industries, including health, manufacturing, and retail. Data modeling helps these
2
industries to make better decisions. They can see trends, make predictions, and solve
problems with good data. Let us see how data is used in these industries.
Healthcare
In healthcare, data represents information about patients, their health, and
treatments.
Data, such as their names, ages, and medical history, is collected from patient
records.
Records of patients help doctors and nurses keep track of patients' health
over time. They can see if someone had an illness before, what medicines they
Data is also used to predict and prevent diseases. Doctors use data to see if
many people in one area are getting sick, and this can help them take action
patients database
Manufacturing
Data is used to give instructions. It tells the machines how to cut, shape, and
This data helps ensure that the robot is built correctly and safely.
If the data shows something is wrong, like a part that is too hot, the
3
Retail
Data is used to keep track of stocks in the store. The store's computer
subtracts one from the item's count when you buy something. The computer
can automatically order more from a supplier if the count gets low. This way,
Data is also used to decide how much things should cost. If something is
selling quickly, the store might raise the price slightly. They might lower the
of related data in the form of tables. Data in each table is stored in rows and
The database below shows you an example of stored medical patients data:
Database structures
Databases are useful because they store data in a structured way. When structured
(organised), data can be manipulated easily and then output differently. Databases
Tables
Records
Fields
Data/Value
4
Creating database
MS Access is a Database Management Software available in the Microsoft Office
window appears.
Name section.
Data type
A data type is used to specify the type of data that can be entered in a particular field
values) and date and time. A field with a number data type will not allow you to enter
text values. You must select the correct data type for each field, depending on the
value you enter. The common data types used in MS Access, along with their
5
Creating table
A default table, ‘Table1’, is automatically created whenever you create a new
database. You can add the fields for this table and rename it.
Steps to create a table
Step 1: Select the Create tab and click Table from the Tables section. A new table
Step 2: Select ViewDesign View to define the fields for this table. A Save As dialog
box appears.
Step 4: Enter the required field names and select the appropriate data type.
the table.
table appears as
shown.
6
Views of a Table
A table has different views, namely Design View and Datasheet View. In the Design
View, you can define the fields of the table, while the Datasheet View is used to enter
Step 2: . Right-click on the table name and select the Design view to open the table
in the design view. You can edit or change the field names or data types of fields in a
table.
table.
Step 2: Click the View Datasheet View option present in the Views section of
Step 3: Enter the data value in each field. You can use the Tab key to move from one
cell to another.
Step 4: Press the Enter key when done. MS Access automatically saves the new
record added to the table. Repeat the same for adding more records.
7
Primary key
Every single record in a database must have something to identify it uniquely. This is
called the 'Primary Key' or the 'Key Field'. A primary key is thus defined as one or
more fields (columns) whose values uniquely identify each record in a table. A
primary key cannot allow Null values and must always have a unique index.
Here are a few examples of which field can be chosen as a ‘Primary Key’ in a
database.
When patients go into the hospital, they are given a patient number (primary
key).
key option from the list. You can set the Indexed value to “Yes, No Duplicates” so
that Access can automatically increment the value for each new record.
8
Activity 1
Create the given table in MS Access as shown below:
Step 3: A Save As window appears. Add a suitable file name in the File name textbox.
Step 5: A database with the desired name is saved and the database name appears
Step 6: Once you have saved the file, click the Close Database option from the File
9.3 Query
A query is a database object that allows you to view, analyse or manipulate specific
data stored in a database. It retrieves data from a table or tables based on the
9
specified conditions and displays it as another table. To find details belonging to a
particular field or record, specify a condition in a query and then ‘run’ the query. The
database would search for all records that match the criteria you specified. Queries
can be used to search for data from more than one field.
using the comparison operators. Let us look at some of the operators that can be
used in a database.
Step 3: Click the Create tab on the ribbon and click the Query Wizard button in the
10
Step 4: Select the table to add to the query and click Add. Click Close.
displayed.
11
Step 7: Click the Save button. Enter a name for the query. Click OK.
Step 8: Open the query or click the Run button if you are in Design view.
12
Creating a query with Query wizard
Steps to create a query using the Query Design
Step 1: Click on the Create tab and then click on ‘Query Wizard’.
Step 2: In the ‘New Query’ box, be sure that ‘Simple Query Wizard’ is selected and
click ‘Ok’.
Step 3: In the ‘Simple Query’ wizard box, select the fields from each table needed to
b. Select the fields by highlighting them in the ‘Available Fields’ box and using the
Step 5: Change the name of the query. Click ‘Open the query to view information’
13
Step 6: The query will then be displayed in the Datasheet view.
Activity 2
Create a database named "LibrarySystem" with tables "Books" and "Authors,". Create
a query to retrieve the titles and publication years of all books written by a specific
author.
14
Unit Review
1. Data is crucial in modeling scenarios and making informed decisions across
5. A data type is used to specify the type of data that can be entered in a
6. A table has different views, namely Design View and Datasheet View.
7. In the Design View, you can define the fields of the table, while the Datasheet
8. A primary key is thus defined as one or more fields (columns) whose values
9. To make/remove a field as a primary key, right-click on the field and click the
10. A query is a database object that allows you to view, analyse or manipulate
11. MS Access allows you to create queries in two ways: Creating a query with a
15
Check for Understanding
1. Answer the following questions.
a. Explain the relation between tables, fields and records with the help of an
example.
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
b. James has created a table for his bookstore. The table includes Book code, Book
name, Book publisher and Book cost. Which field will he select for creating the
primary key? Why?
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
c. Reena wants to view, analyse and retrieve specific data from the database. Explain
the component of MS Access that would help him to do the same.
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
16
Lab Activity
Q1. Create a database "EmployeeData" with a table named "EmployeeInfo" that
"Salary. Create a query to retrieve the data of employees earning more than 50,000.
Resources
https://edu.gcfglobal.org/en/access2016/
Reference Material
https://www.youtube.com/watch?v=eXiCza050ug&list=PLpQQipWcxwt-EHfE5zXtUrLtFYnOPBRE_
17