A-level Computing 2009/AQA/Problem Solving, Programming, Operating Systems, Databases and Networking/Databases/Databases





Table
In our database we will store information about 'things', or more technically, entities. To store data about things we use Tables. Each table will store data about a particular thing. Let's look at two examples: Database: Crime in a local area Tables: Crimes, Victims, Criminals, Police Officers And looking at another example that you might be familiar with, a social networking site: Database: Social Network Tables: People, Relationships, Messages, Pictures

Team Player Match Stadium Referee

Staff Products Receipts Customers

Attribute/Field
Now we have gotten to grips with recognising the main tables we need to store in each database, we need to recognise what fields of data will be stored in each of these tables. The data items to be stored are called the attributes. Taking the Criminal database as an example:
 * Table: Criminal
 * Attributes:
 * Name: String
 * Date of Birth: Date
 * Number of scars: Integer
 * Home town: String

Note that for each of the attributes we are listing the attribute name and the field type, when building a database it is very important that we get the correct field type to prevent errors when entering data. Let's take a look at another example from the criminals Database
 * Table: Crimes
 * NI Number: String
 * Description: String
 * Type of crime: String
 * Severity: Integer
 * Date of Crime: Date
 * Victim ID: Integer
 * Criminal ID: Integer

Name: string Date of Birth: Date Gender: string (character might also work here) Public profile: boolean Personal description: String

Person1 ID: integer Person2 ID: integer Type of relationship: string Date created: Date