O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16

Comparison or Theta Operators

Dr. Codd introduced the term “theta operators” in his early papers, for what a programmer would have called a comparison predicate operator. The large number of data types in SQL makes doing comparisons a little harder than in other programming languages. Values of one data type have to be promoted to values of the other data type before the comparison can be done. SQL is a strongly typed language, which means a lot of type castings are not possible—you cannot turn Christmas into a number and find its square root.

The comparison operators are overloaded and will work for <numeric>, <character>, and <datetime> data types. The symbols and meanings for comparison operators are shown in Table 16.1.

Table 16.1

Symbols ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required