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.
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.
Check yourself
- What is a primary key?
- Which SQL keyword sorts results?
- Which data type suits a field storing whether a fee has been paid?
Show answers
- A field that uniquely identifies each record.
- ORDER BY.
- Boolean.
Questions about this topic (0)
No questions about this topic yet.
Sign in or create a free account to join in.