0% found this document useful (0 votes)
12 views3 pages

Database Notes

The document discusses different types of databases including flat-file and relational databases. Flat-file databases store all data in one table while relational databases store data across multiple linked tables. Relational databases use primary and foreign keys to link tables together. The document also describes different data types that can be used such as alphanumeric, numeric, Boolean, and date/time.

Uploaded by

oliviawanjiku646
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Database Notes

The document discusses different types of databases including flat-file and relational databases. Flat-file databases store all data in one table while relational databases store data across multiple linked tables. Relational databases use primary and foreign keys to link tables together. The document also describes different data types that can be used such as alphanumeric, numeric, Boolean, and date/time.

Uploaded by

oliviawanjiku646
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

A database is an organised collection of data.

A database program is software


which stores and retrieves data in a structured way. This includes the data that
is stored and the links between the data items. All databases store data using a
system of files, records and fields:
» A field is a single item of data, such as a forename or date of birth. Each field
has a field name that is used to identify it within the database. Each field
contains one type of data, for example numbers, text or a date.
» A record is a collection of fields, for example, all the information about one
person or one item. These may contain different data types.
» A file (in database terms) is an organised collection of records, usually where
all the records are organised so that they can be stored together. A file can
have one or more tables within it.
Although all databases have these three elements in common, there are two
types: flat-file databases and relational databases.

Flat-file databases
A flat-file database stores its data in one table, which is organised by rows and
columns. For example, in the following database about teachers, each record (row) in the table
contains data about one person. Each column in the table
contains a field, which has been given a field name, and each cell in that column
has the same, predefined data type.

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. The
tables within a relational database are linked with relationships (hence the name).
Key fields
Each table within a relational database will have a key field. The relationships
linking the tables use these key fields

Primary and foreign key fields


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 that record. Some
tables will have one or more foreign key fields. A foreign key field in one data
table stores values from a primary key field in another table.
Using the earlier example, if we wanted to add to the table the names of each
student taught by each teacher using a flat-file database, the table would look
like this:

If the data is split into two tables – one for the teachers and one for the
students – that are linked together, it can be stored and retrieved more
efficiently, like this:

These two tables are linked with a ‘one-to-many’ relationship, because one
teacher’s record is linked to many students’ records. The primary key fields (which
must contain unique data) are the Student_ID and Teacher_ID
Data types and sub-types
Alphanumeric data can store alpha characters (text) or numeric data
(numbers) that will not be used for calculations. In Access this is called a text
field.
» A numeric data type (as the name suggests) is used to store numeric values
that may be used for calculations. This does not include numeric data such as
telephone numbers, which should be stored in an alphanumeric data type.
In Access this is called a number field. There are different types of numeric
field including:
– integer sub-type, which stores whole numbers. In Access you can select an
integer field or a long integer field. It is wise to use a long integer field if
it is going to contain three or more digits
– decimal sub-type, which will allow a large number of decimal places, or a
specified restricted number if this is set in the field properties when the
database is created
– currency sub-type, which will allow currency formatting to be added to the
display. This includes currency symbols and regional symbols. The database
does not store these symbols as this would use up valuable storage space
– date and time sub-type, which stores a date and/or time as a number.
» A Boolean (or logical) data type stores data as 0/-1 but can display it as Yes/
No (or True/False, 0/1).

You might also like