GITTA-Logo
PDF Version of this document Search Help

Lesson Navigation IconStructured Query Language SQL

Unit Navigation IconSQL overview

Unit Navigation IconCreation and modification of tables

Unit Navigation IconBasic database queries

LO Navigation IconSelect-From-Where

LO Navigation IconMultiple conditions

LO Navigation IconComparison operators

LO Navigation IconArithmetical operators

LO Navigation IconNested queries

LO Navigation IconJoin

LO Navigation IconNon-relational constructs

LO Navigation IconSet operators

LO Navigation IconSummary

LO Navigation IconDatabase queries

Unit Navigation IconSQL Insert, Delete and Update

Unit Navigation IconUsage of SQL

Unit Navigation IconSummary

Unit Navigation IconRecommended Reading

Unit Navigation IconBibliography

Unit Navigation IconMetadata


GITTA/CartouCHe news:


Go to previous page Go to next page

Multiple conditions

In SQL it is possible to have multiple conditions and combine them with boolean operators (AND, OR). For negating a condition the NOT operator is used. The data is selected if the whole condition returns as TRUE.

Multiple conditions

Other examples of multiple conditions:

  • PLZ = 8000 AND NOT Last name = 'Schmidt'
  • PLZ = 8000 OR PLZ = 8006
  • (Last Name = 'Müller' OR Last name = 'Meier') AND Place = 'Zürich'
remark In SQL queries (e.g. conditions) text must be set in single quotation marks. Numerical values are written without single quotation marks. This can be seen in the examples.


Instead of a long chaining with AND there is also the possibility to compare several attributes simultaneously with each other:

First name = 'Ursula' AND Last name = 'Müller' newLine space="long"/> can be written as:

(First name, Last name) = ('Ursula', 'Müller')

Top Go to previous page Go to next page