AeroLab Reading room

CS / IGCSE

Databases, Boolean logic and queries

A relational table contains records and fields. A primary key identifies records; queries select and organise data using conditions rather than changing its meaning.

Learning objectives

The big idea

A relational table contains records and fields. A primary key identifies records; queries select and organise data using conditions rather than changing its meaning.

Logic gates implement Boolean operations. Construct a truth table by enumerating every input combination; AND requires both inputs, OR requires at least one and NOT reverses a truth value.

Equations and relationships

NOT(A AND B) = (NOT A) OR (NOT B)

One of De Morgan’s laws.

Worked example

What is 1 XOR 1?

Follow the solution

Exclusive OR is true only when the two input bits differ.

Investigate and explain

Predict the worked result before calculating. Change one input, record the new result, and explain which assumptions still hold.

Use the prediction activity below; a local model appears only where it supports this topic.

Open the interactive investigation

Check your understanding

1. What is a primary key for?

  1. Storing every field twice
  2. Uniquely identifying a record
  3. Encrypting a table automatically
Check the answer and reasoning

Uniquely identifying a record

Uniqueness allows a record to be referenced unambiguously.

2. What is 1 XOR 1?

  1. 1
  2. 2
  3. 0
Check the answer and reasoning

0

Exclusive OR is true only when the two input bits differ.

3. Does SQL WHERE change the stored rows in a SELECT query?

  1. No
  2. Yes
  3. Only for numbers
Check the answer and reasoning

No

WHERE filters returned results; SELECT does not itself modify the source table.