Chapter 5
Chapter 5
Chapter 5
Introduction to databases
1. Numeric data
Numeric data simply means numbers. Numbers come in a variety of different types:
Integer
• Positive or negative whole number
• Examples: 12, 45, 1274, 1000000, -3, -5735
Real/Decimal
• Positive or negative numbers with decimal/fractional parts
• 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 any number that is followed by a percent symbol
• Examples: 100%, 25%, 1200%, -5%.
2. Alphanumeric/Text data
• Alphanumeric data refers to data made up of letters and numbers.
• Examples: DOG, "A little mouse", ABC123, [email protected].
3. Boolean data
• Boolean data can only have two values.
• Examples: TRUE and FALSE, YES and NO, ON and OFF, Male and Female.
4. Date/Time data
• Date/Time data is usually formatted in a specific way according to the setup of the
computer and the user’s preferences.
• Date Examples: 25/10/2007, 12 Mar 2008, 10-06-08.
• Time Examples: 11 am, 15:00, 3:00 pm, 17:05:45.
• Student name
A column that contains one specific piece of
Field • Student ID
information and has one data type
• Age
• Address
• Gender
A row within a table that contains data about a Details (all information) of
Record
single item, person or event one student
Primary Key
Flat-file database
Definition:
Database where all the data is held in a single table.
Example:
Relational database
Definition:
• Contains more than one table linked to each other
• It uses relationships
• It makes use of foreign key
Example:
For this example, all the data about customers is held in one file, and all the data about jobs is
held in another file. To create a connection between the two files, a relationship must be created
Foreign keys
Definition:
• It is a primary key in another table
• Needed to act as a link between two tables.
Example:
'Customer ID' field acts as the primary key in the customer file and the foreign key in the job
file, thus enabling a relationship between the two tables.
Relationships
A relationship is a link or association between fields.
Visual check
Definition:
• Data is compared visually with the source document by a user
• The user is asked to confirm that the data entered is the same as the original
• If the user finds a difference, the data is re-entered