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

Comparison operators

SQL supports different comparison operators. They can be used to compare attributes with constants or with other attributes. DIf an operator is used to compare an attribute with a constant, we talk about restriction. If the operator is used to compare two attributes, then we talk about a join. With joins, data from different relations can be compared and combined. Of course only attributes with the same domain (value range) can be compared.

The following comparison operators for numerical attributes are supported:

  • = equal
  • > greater
  • < less
  • >= greater than or equal
  • <= less than or equal
  • <> not equal
  • BETWEEN between

Conditions usually have the syntax <atribute> <operator> <value>. The operator BETWEEN has a somehow different syntax (see the example).
Other comparison operators are discussed in the next paragraphs.

Comparison operators
remark If in the SELECT-clause a star (*) instead of an attribute list is used, then all attributes of the relations specified in the FROM part of the query are displayed.
Top Go to previous page Go to next page