Skip to content
Cambridge AS & A Level9626

Creating a database

Information Technology 9626 Chapter Notes

Last updated November 2026

ShareWhatsAppPost

Creating a database notes as a printable PDF.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Creating a database notes as text: skim, search, and jump between subtopics.

~14 min read

1. Data types and field sizes

Every field is given a data type and, for alphanumeric data, a field size. The data types are text, alphanumeric, numeric (integer or decimal), date, time and Boolean.

Names are text/alphanumeric. A yes/no field is Boolean. Money is currency/numeric: a rate of pay is not always a whole number, so it is not an integer.

A decimal type would not display the currency symbol. A telephone number is alphanumeric, because it starts with a zero and is never used in a calculation.

Examiner insight

“Some candidates did not appreciate that hourly_rate_of_pay would not necessarily be a whole number, and so suggested integer as the most appropriate data type.” “Future candidates must understand that only numeric data that could be used in a calculation should be numeric data types, other fields such as telephone number and in this database zip code, could never be used for a calculation and should therefore be set as alphanumeric data types.”

Worked example 13 marks

Each field name below is from a database. For each field name, identify the most appropriate data type.

Field nameMost appropriate data type
`employee_name`
`hourly_rate_of_pay`
`was_employee_born_in_france?`
  1. 1

    `employee_name`: text/alphanumeric [1]

  2. 2

    `hourly_rate_of_pay`: currency/numeric [1]

  3. 3

    `was_employee_born_in_france?`: Boolean [1]

2. Relationships and referential integrity

There are three relationships: one-to-one, one-to-many and many-to-many. When you draw a link, name the relationship and check its direction.

A many-to-many relationship is not linked directly. It is broken into two one-to-many relationships using a third table, a link table.

Referential integrity describes the relationship between two tables. It ensures that all data remains consistent, because every foreign key depends on a matching primary key. It warns the user who tries to delete parent data.

Examiner insight

“Very few candidates seemed to know what was meant by the term ‘referential integrity’.” “The majority of candidates drew the link and a large number also identified it as a one-many relationship but often in the wrong direction.”

Worked example 14 marks

Discuss the importance of referential integrity.

  1. 1

    It ensures that all data in a database remains consistent [1]

  2. 2

    It ensures that all foreign keys are dependent on the matching primary key [1]

  3. 3

    It gives the user a warning if they try to delete parent data [1]

  4. 4

    It helps to reduce redundant data [1]

3. Key fields

A primary key contains unique data, cannot contain a null value and there is only one per table. It uniquely identifies a record. A foreign key is a primary key from a different table.

A composite key is a primary key that uses the contents of two or more fields from a table to create a unique value. A compound key is a primary key that combines more than one foreign key to create a unique value.

Set the key fields exactly as the data dictionary says.

Examiner insight

“The majority of responses did not define what a compound key is and consequently could not provide an example.” “Although candidates demonstrated awareness that it used more than one field, they did not clearly state that these were combined to form a unique value.”

Worked example 14 marks

A student is planning a relational database. The relational database could include both primary keys and compound keys.

(b)(i) Describe the characteristics of a primary key in a relational database.

(ii) Describe the role of a primary key in a relational database.

(c) Describe how a compound key differs from a primary key.

  1. 1

    (b)(i) It contains unique data [1]

  2. 2

    (b)(i) It cannot contain a null value [1]

  3. 3

    (b)(ii) It uniquely identifies a record [1]

  4. 4

    (c) A compound key is based on more than one column, a primary key on one column [1]

4. Flat files, relational databases and ERDs

A relational database stores data in more than one linked table. A flat file does not, so its data is repeated. In a relational database data is only entered once.

An entity relationship diagram (ERD) names the entities, with the attributes below each name, and links the entities in general terms. The links do not point at individual fields. A conceptual ERD has no data types, key fields or field lengths. Logical and physical ERDs are also in the syllabus.

To create a relational database, build the tables, field names, data types, primary keys and field sizes exactly as the data dictionary specifies.

Examiner insight

“Many responses listed features of one or the other type of database but did not explain the differences.” “The descriptions were more often than not describing what a relational database consists of rather than answering the question regarding how to create one.”

Worked example 14 marks

A company wishes to gather some information from employees.

(b) Justify the use of a relational database to store the information gathered.

  1. 1

    You can create complex reports [1]

  2. 2

    because data from multiple tables can be combined [1]

  3. 3

    Data is not repeated, as it is only entered once [1]

  4. 4

    so it is quicker and easier to modify the data [1]

5. Validation and verification

Validation checks that entered data is reasonable. A range check tests a value is between two figures. A limit check tests it is not below or above a certain figure. Others are type, format (for example dd/mm/yyyy), lookup (a list of values) and character checks.

A range check has both an upper and a lower value. A limit check has one.

Verification compares two versions of the data, by visual checking or double data entry. Proof reading is not verification. Test a validation rule with test data, not with other checks.

Examiner insight

“Confused formats, so that one value was given for a range, for example.” “Where describing a range check, it is vital that responses include awareness that a range check has both an upper and a lower value.”

Worked example 14 marks

A presence check has already been run on each field of the database.

For each of the following fields, identify and describe one other type of validation that can be used. You should only use each type of validation once.

(i) `hourly_rate_of_pay`

(ii) `date_of_birth`

  1. 1

    (i) Range check [1]

  2. 2

    (i) to check the value is between two figures [1]

  3. 3

    (ii) Format check [1]

  4. 4

    (ii) to check the date is entered as dd/mm/yyyy [1]

6. Choosing and running queries

A simple query searches on a single criterion. A complex query searches on more than one parameter value, often with AND, OR or NOT. A summary query uses aggregate functions such as SUM, AVERAGE, MIN, MAX and COUNT on a group of records. A nested query is a query within another query: the innermost runs first.

A static parameter query has its criterion written into it, so it must be rewritten to search for something else. A dynamic parameter query prompts the user for an input each time it runs.

Queries can also find and remove duplicate records.

Examiner insight

“Very few described the need to rewrite a static query if the parameters had to be changed.” “Responses that gained credit gave examples of the functions used within a summary query but without saying what a summary query is.”

Worked example 15 marks

(a) Describe the term dynamic parameter query.

(b) Describe the benefits of using dynamic parameter queries when using a database.

  1. 1

    (a) A query that prompts the user for an input [1]

  2. 2

    (a) Allows the parameter/criteria to be changed each time [1]

  3. 3

    (b) Requires little technical knowledge by the end user [1]

  4. 4

    (b) Saves time, as a new query is not created every time [1]

  5. 5

    (b) Reduces the number of queries saved [1]

7. Calculations and sorting

A calculated field works out its value from other fields, using arithmetic operations and numeric and logical functions. A calculated control does the same on a form or report.

A calculated field gives a changing, dynamic figure, so it stays accurate. Show its result in the same format as the field it uses.

Sort data ascending or descending, on more than one criterion if needed. Name the field and the order.

Examiner insight

“Candidates did not take into account the relevance of date within the year and stated that the age was now minus year of birth.” “Even those that did gain a mark usually achieved this for sorting, though several of these did not mention which field it was being sorted on or in what order.”

Worked example 13 marks

Justify why a field holding the age of each employee has been set as a calculated field.

  1. 1

    Age is based on the calculation between date of birth and today [1]

  2. 2

    Age constantly increases with time [1]

  3. 3

    A calculated field allows for a changing/dynamic figure [1]

8. Forms, reports, switchboards, import and export

A data entry form uses drop-down menus and radio buttons to force entries to comply, highlights key fields so important data is not missed, and uses white space so the screen is not cluttered. Font styles and sizes, field spacing and object sizes are also set.

A report can be grouped and can use calculated controls. Label fields appropriately, add a title and fit the data on the page. A switchboard (menu) has consistent buttons with appropriate labels. It is not a form.

Data is imported from csv and txt files. A table, query or report is exported as csv, txt or rtf. Check imported fields against the data dictionary.

Examiner insight

“Most candidates did not produce a switchboard but created a design of a form.” “At AS level candidates should be labelling fields appropriately, which was not always seen in all submissions.”

Worked example 14 marks

A school library keeps a table of books. It has the fields `ISBN`, `book_type` (fiction or non-fiction) and `copies`. Describe four features of a well-designed data entry form for this table.

  1. 1

    Drop-down menu for a field with a list of values, so the user picks rather than types [1]

  2. 2

    Radio buttons for `book_type`, which has only two options [1]

  3. 3

    `ISBN` highlighted as the key field, so it is not missed [1]

  4. 4

    White space between fields, so the screen is not cluttered [1]

Recap

  • Data types: text/alphanumeric, numeric (integer, decimal), date, time, Boolean. Money is currency/numeric.
  • Relationships: one-to-one, one-to-many, many-to-many. Many-to-many needs a link table and two one-to-many relationships.
  • Primary key: unique, no null value, one per table. Foreign key: a primary key from another table.
  • Composite key: two or more fields from one table. Compound key: more than one foreign key.
  • Referential integrity keeps data consistent and warns when parent data is deleted.
  • Relational database: more than one linked table, data entered once.
  • Validation checks data is reasonable. Verification compares two versions of the data.
  • Static parameter query: criterion written in. Dynamic: prompts the user each time.
  • Calculated fields stay accurate. When sorting, name the field and the order.

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. A shop stores each customer's telephone number, for example 01632 960123. State the most appropriate data type for the field and give a reason.2 marks
    Answer
    1. Text/alphanumeric [1].
    2. The number starts with a zero and has a space, and it is never used in a calculation [1].

    Trap: Integer would drop the leading zero.

  2. A school database has a `Student` table and a `Club` table. A student can join many clubs and a club has many students. Name this relationship and state how the database links the two tables.3 marks
    Answer
    1. Many-to-many [1].
    2. It is broken into two one-to-many relationships [1].
    3. A third table, the link table, joins them [1].

    Trap: Linking the two tables directly with one many-to-many link.

  3. The `Order` table has the fields `OrderID`, `CustomerID` and `OrderDate`. Each order has its own `OrderID`. The `Customer` table has the fields `CustomerID` and `Name`. State the primary key of `Order`, and the foreign key in `Order` with the table it links to.3 marks
    Answer
    1. Primary key: `OrderID` [1].
    2. Foreign key: `CustomerID` [1].
    3. It is the primary key of the `Customer` table [1].

    Trap: Naming a key without saying which table it belongs to.

  4. A `Class` table holds the `TeacherID` of each class's teacher. A user tries to delete a teacher who still has classes. Explain how referential integrity helps.3 marks
    Answer
    1. It warns the user that they are trying to delete parent data [1].
    2. Every foreign key must depend on a matching primary key, so no class is left with a `TeacherID` that matches no teacher [1].
    3. This keeps the data consistent [1].

    Trap: Describing how to set it up. The question asks for the reason it is used.

  5. A clinic stores every appointment in one flat file. The patient's name and address are typed again for each appointment. Give two problems with this and explain how a relational database solves them.4 marks
    Answer
    1. Problem 1: data is repeated, so there is more chance of storing incorrect copies [1].
    2. Problem 2: repeated data uses more storage space [1].
    3. A relational database holds each patient once, in its own table [1].
    4. That table is linked to the appointments table, so a change is made once [1].

    Trap: Listing features of one type without explaining the difference.

  6. A field stores a pupil's test mark out of 100. (a) Name a validation check for the field and state what it checks. (b) A mark of 85 is typed as 58. Explain why validation does not find the mistake and name a method of verification that would.4 marks
    Answer
    1. (a)
    2. Range check [1].
    3. It checks the mark is between 0 and 100 [1].
    4. (b)
    5. 58 is between 0 and 100, so it passes the range check [1].
    6. Double data entry compares two versions of the data and finds the difference [1].

    Trap: A range check needs both an upper and a lower value. Validation does not prove data is correct.

  7. A table `Book` has the fields `Title`, `Genre`, `Year` and `Copies`. Name the best query type for each task. (a) List the titles of Science books published after 2015. (b) Find the total number of copies of each genre. (c) Ask the librarian for a genre each time, then list that genre's titles.3 marks
    Answer
    1. (a)
    2. Complex query: two fields, `Genre` and `Year`, joined by AND [1].
    3. (b)
    4. Summary query: SUM of `Copies`, grouped by `Genre` [1].
    5. (c)
    6. Dynamic parameter query: it prompts the user for the genre [1].

    Trap: It is the query that is static or dynamic, not the data.

  8. An orders table holds `Quantity` and `UnitPrice`. A calculated field `Total` multiplies them. (a) Give the value of `Total` for 12 items at 4.50 each. (b) The quantity changes to 15. State what happens to `Total` and why this is better than typing the total.3 marks
    Answer
    1. (a)
    2. 12 × 4.50 = 54.00 [1].
    3. (b)
    4. `Total` recalculates automatically: 15 × 4.50 = 67.50 [1].
    5. A typed total would go out of date and could contain a human error [1].

    Trap: Show the result with two decimal places, like the price field.

  9. A report lists staff. It must group employees by `Department` and, within each department, list the highest `Salary` first. Each group must end with the total salary for that group. Describe how the report is set up.4 marks
    Answer
    1. Group the report on `Department` [1].
    2. Sort `Salary` in descending order within each group [1].
    3. Add a calculated control at the end of each group [1].
    4. The control uses SUM on `Salary` [1].

    Trap: Saying 'sort by salary' without giving the order.

  10. A sports club keeps one csv file with the columns `MemberName`, `Team`, `Coach` and `Fee`. Each member is in one team. Each team has one coach and many members. Describe how to turn this file into a relational database.6 marks
    Answer
    1. Make two tables, `Member` and `Team`, so each coach is stored once [1].
    2. `Team` has a primary key `TeamID` and holds `Coach` [1].
    3. `Member` has a primary key `MemberID`, holds `MemberName` and `Fee`, and has `TeamID` as a foreign key [1].
    4. Set a one-to-many relationship from `Team` to `Member` [1].
    5. Set data types and field sizes as the data dictionary says: text for names, currency for `Fee` [1].
    6. Import the csv data into the tables and check the fields match [1].

    Trap: Letting the import wizard choose names and data types, so the database does not match the data dictionary.

Say this, not that

Wording that loses the mark, against the wording the mark scheme credits.

Loses the markGets the mark
Integer for `hourly_rate_of_pay`Currency/numeric, because a rate of pay is not always a whole number
The data is static or dynamicA dynamic parameter query prompts the user for an input; a static query must be rewritten
A compound key is a single fieldA compound key combines more than one foreign key to create a unique value
Proof reading is verificationVerification compares two versions of the data, by visual checking or double data entry

Frequently asked questions

Which data type should be used for money, such as an hourly rate of pay?
Money is currency/numeric. A rate of pay is not always a whole number, so integer is the wrong type. A decimal type would not display the currency symbol. Names are text/alphanumeric, and a yes/no field is Boolean.
What is referential integrity?
Referential integrity describes the relationship between two tables. It ensures that all data remains consistent, because every foreign key depends on a matching primary key. It gives the user a warning if they try to delete parent data, and it helps to reduce redundant data.
How does a compound key differ from a primary key?
A primary key contains unique data, cannot contain a null value, uniquely identifies a record, and there is only one per table. A compound key combines more than one foreign key to create a unique value. A composite key uses the contents of two or more fields from one table.
How is a many-to-many relationship set up in a relational database?
A many-to-many relationship is not linked directly. It is broken into two one-to-many relationships using a third table, a link table. For example, a student can join many clubs and a club has many students, so the link table joins the Student table and the Club table.
What is the difference between a static and a dynamic parameter query?
A static parameter query has its criterion written into it, so it must be rewritten to search for something else. A dynamic parameter query prompts the user for an input each time it runs. Dynamic queries save time, as a new query is not created every time.
Why do students lose marks on data types?
A common mistake is choosing integer for a rate of pay, which is not always a whole number, or for a telephone number. A telephone number has a leading zero and spaces, and it is never used in a calculation, so text or alphanumeric is correct. Give the reason, not only the type.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters