all bits considered data to information to knowledge

1Dec/100

A CLAUSE or an OPERATOR?

Once in a while I come across internet articles explaining basic concepts of SQL to the beginner and intermediate programmers; and every time I see confusion in terminology. This time it was a discussion of what author called “EXCEPT clause” in SQL Sever.

Except that it is not a CLAUSE, it is an OPERATOR.

A definition of a clause is “a group of words containing a subject and predicate and functioning as a member of a complex or compound sentence”; therefore WHERE, GROUP BY and ORDER BY are rightfully classified as clauses.

An operator is defined as “something … that … performs a mathematical or logical operation” (Merriam Webster definition). Therefore EXCEPT is an operator performing logical operation upon two sets of data returned by the queries.

There are clauses in SQL to be sure: a WHERE clause, ORDER BY clause, HAVING clause, but neither EXCEPT nor its opposite INTERSECT belong into this category. They  are operators.

There is a Chinese Proverb stating that the beginning of wisdom is to call things by their right name. This could be a good start.