Cambridge Ict Notes Ch5
Cambridge Ict Notes Ch5
5: Introduction to databases
I.C.T.
Chapter 5
Introduction to databases
1.
Numeric
Data
Numeric data simply means numbers. However, numbers come in a variety of
different types.
• Integers
An integer is a whole number - it has no decimal or fractional parts. Integers can be
either positive or negative.
Examples: 12, 45, 1274, 1000000, -3, -5735.
• Real Numbers
Real numbers include whole numbers (integers) and numbers with decimal/fractional
parts. Real numbers can be positive or negative.
Examples: 1, 1.4534, 946.5, -0.0003, 3.142.
• Currency
Currency refers to real numbers that are preceded by a currency symbol.
Examples: £12.45, -£0.01, €999.00, $5500.
• Percentage
Percentage refers to fractional real numbers that are followed by a percent symbol.
So, the real value 0.5 would be shown as 50%, the value 0.01 would be shown as
1% and the number 1.25 would be shown as 125%. Inside the computer the 50% is
stored as a real number: 0.5, But when it is displayed it is shown formatted as a
percentage.
Examples: 100%, 25%, 1200%, -5%.
2.
Alphanumeric/Text
Data
Alphanumeric (often simply called 'text') data refers to data made up of letters
(alphabet) and numbers (numeric). Usually symbols ($%^+@, etc.) and spaces are
also allowed.
Examples: DOG, "A little mouse", ABC123, [email protected].
3.
Date/Time
Data
Date (or time) data is usually formatted in a specific way. The format depends upon
the setup of the computer, the software in use and the user's preferences.
Date Examples: 25/10/2007, 12 Mar 2008, 10-06-08.
Time Examples: 11am, 15:00, 3:00pm, 17:05:45.
4.
Boolean/Logical
Data
Boolean data is sometimes called 'logical1 data (or in some software, 'Yes/No' data).
Boolean data can only have two values: TRUE or FALSE.
Note that TRUE and FALSE can also be shown as YES / NO, ON / OFF, or even
graphically as tick boxes (ticked / unticked).
Examples: TRUE, FALSE, YES, NO, ON, OFF.
Note that the telephone number in the example to the left has a data type of
alphanumeric. You might think that it should be numeric, however phone numbers
often have spaces, dashes, etc. which numeric data cannot have.
Record
A record is a group of related items of data, which together can be treated as a unit.
File
A file is an organized collection of related records
Field
name
A field name is the title given to each field and is always present at the top row of
table.
Flat-‐file
databases
A flat-file system refers to a database where all the date is held in a single table or
file. An example of a flat file database is given below.
Relational
databases
A relational database stores data in more than one linked table, stored in a file.
Relational databases are designed so that the same data is not stored many times.
Each table within a relational database will have a primary key. Most tables will have
a primary key field that holds unique data (no two records are the same in this field)
and is the field used to identify this record.
For this example, all the data associated with the customer is held in one file and all
the data associated with each job is held in another file. In order to create a
connection between the two sets of data, a relationship must be created by using
two key fields.
Foreign
keys
The foreign key is the destination point of the relationship. It remains a unique
identifier as regards the customer file but it may occur more than once in the job file
because the customer may have more than one job.
As you can see, the 'Customer ID' field acts as the primary key in the customer file
and foreign key in the job file, thus enabling a relationship between the two tables.
Relationships
A relationship is a term used with relational databases to indicate a link or
association between fields. The relationship between the tables can be:
• one-to-one
o Like the relationship between a person and their ID card. One person
has only one ID card and the ID card is associated only to one person.
• one-to-may
o Like the relationship between a father and his children. One father has
many children but each child only has one father.
• many-to-many
o Like the relationship between students and courses. One student can
take several courses and each course can be taken by several
students. Thus the relationship is many to many.
Visual
check
This is checking for errors by the person who is entering the data. They compare the
entered data with the original document (i.e, what is on the screen is compared to
the data on the original paper documents – note that this is not the same as
proofreading).