Databases are used to store large amounts of data, organised into tables.
Table 1 shows some rows of an example table, called Students.
Table 1
| StudentID | FirstName | LastName | DateOfBirth |
|---|---|---|---|
| 1225 | William | Smith | 15/04/2009 |
| 1226 | Sid | Chopra | 04/11/2008 |
| 1227 | Freddie | Brown | 28/01/2009 |
| 1228 | William | Jones | 13/09/2008 |
Tables are the basis of databases. The columns of a table (StudentID,
FirstName, LastName, DateOfBirth) are called fields, and the
rows are called records.
Each table have a table name, and each field has a field name. Each record can usually be identified by a primary key.
The primary key of a table is a field (column) which can uniquely identify each record.
This means that each record has a different value in the primary key field. In Table 1, the primary key is
the StudentID field. The primary key will usually be the first column in the table.
Fields in tables have their own data type, which work just like normal programming languages. The main data
types are:
Integer (whole number)Float / Real (number with a decimal part)Date, Time (exactly what it sounds like)Char (fixed length string)Varchar (variable length string)(See also: 2A.02 - Data Types)
What would the data types be for each field in Table 1?
Tap/click to reveal
StudentID - Integer
FirstName - Varchar
LastName - Varchar
DateOfBirth - Date