← Computer Science

Databases and SQL

A single-table database is a tidy grid of records and fields, and SQL is the language we use to pull exactly the data we want out of it. In this lesson we cover the key database terms, why a primary key must be unique, and how to build a query with SELECT, FROM, WHERE and ORDER BY.

Slide 1 / 4

Single-table database terms

A table: records (rows) and fields (columns)StudentIDNameFormClass1001Amy11B1002Ben11Aone row = one record (a student)one column = one field (Name, FormClass)
  • A table stores data about one type of thing, for example a Student table holding data about students.
  • A record (row) holds all the data about one item, such as one student, and a table is made of many records.
  • A field (column) is one piece of data that every record has, such as Surname or DateOfBirth.
  • A field data type says what kind of value a field holds, for example text, numeric, Boolean or date/time.

Check you've got it

0/4

1. Which statement about a primary key is correct?

2. A Student table has fields StudentID, FirstName, Surname and FormClass. Which query lists the first name and surname of every student in class 11B, sorted by surname?

3. In a query, what does SELECT * mean?

4. Which SQL keyword decides which records are returned by testing a condition?

Practise real exam questions on this

Type your answer, see your mark against the mark scheme in seconds. Free, 5 a day.

Start practising →

Teaching this topic?

Mark your whole class's answers and see who's stuck, for £19 a month.

See the class plan →

Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark.