ZIMFundi
Sign inJoin free

Topic 7 of 8 · Form 3

Databases

Fields, records, data types (text/alphanumeric, character, Boolean, integer, real, date/time) and the primary key (unique identifier).

Notes for this topic 1 file, in order

Create a free account to download PDFs.

  1. PDFDatabases – Computer Science notes (Cambridge O Level)45.0 KB

Single-table databases

Fields, records, data types (text/alphanumeric, character, Boolean, integer, real, date/time) and the primary key (unique identifier).

Validation in databases

Range, presence and format checks applied to fields.

SQL queries

SELECT, FROM, WHERE, ORDER BY (ASC/DESC), SUM and COUNT, with AND and OR conditions.

Worked example: Write SQL to show the names and prices of products costing less than US$5, cheapest first.

SELECT Name, Price

FROM Product

WHERE Price < 5

ORDER BY Price ASC;

Worked example: Write SQL to count products in the category "Stationery".

SELECT COUNT(*) FROM Product WHERE Category = 'Stationery';

Why use databases

Fast searching and sorting, reduced duplication, data consistency, and easy reports.

Exam tip: Use quotation marks around text values in WHERE conditions but not around numbers.

Check yourself

  1. What is a primary key?
  2. Which SQL keyword sorts results?
  3. Which data type suits a field storing whether a fee has been paid?
Show answers
  1. A field that uniquely identifies each record.
  2. ORDER BY.
  3. Boolean.
Next topicBoolean logic

Questions about this topic (0)

No questions about this topic yet.