Computer ScienceExam code: 0984

Database Concepts

Databases

Conditions inside WHERE use comparison operators, much like the ones in topic 21.

OperatorMeaningExample
=Equal toWHERE City = 'London'
<>Not equal toWHERE Country <> 'France'
<Less thanWHERE Age < 18
>Greater thanWHERE Salary > 30000
<=Less than or equal toWHERE Mark <= 40
>=Greater than or equal toWHERE Age >= 18

Text values are wrapped in single quotes ('London', 'M'); numbers are written without quotes (30, 40000).

Common slip: writing WHERE City = London (without quotes) makes the database look for a column called London, which does not exist, and the query fails. Always quote text values.

Build on this topic