Week 1-Introduction To Database Notes
Week 1-Introduction To Database Notes
What is a database?
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.
» 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.
Flat-file databases
A flat-file database stores its data in one table, which is organised by rows and columns.
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).
A primary key field is the field that holds unique data (no two records are the same in this field) and
is the field used to identify that record.
A foreign key field in one table stores values from a primary key field in another table.
1. Saves on internal memory and external storage by not storing data more than once.
2. Records/data can be added, edited or deleted. Because data is not repeated in a relational
database, each change to an item of data or to a record has to be made only once.
3. It is also much easier for users to produce reports from a relational database, where data is
held in two or more tables, than from two or more flat-file databases.
4. It is easier and quicker to search using relational rather than flat-file databases where
indexed values are used.
Data types and sub-types
alphanumeric / text-store alpha characters (text) or numeric data (numbers) that will not be
used for calculations.
Numeric- 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 and decimal sub-type, which will allow a large number of decimal
places,
Boolean- stores data as 0/-1 but can display it as Yes/ No (or True/False, 0/1)
Date and time- date and time sub-type, which stores a date and/or time as a number.
Currency- will allow currency formatting to be added to the display. This includes currency
symbols and regional symbols.