Re: What is Orthogonal (Exactly)?

From: Sirin Venigalla <a_at_abc.com>
Date: Mon, 17 Jun 2002 00:43:23 GMT
Message-ID: <LgaP8.19591$uk2.10090449_at_twister.nyroc.rr.com>


When applied to SQL, orthogonality means:

you can replace a scalar value with any SQL statement that produces a scaler, and a vector with a table expression.

Let me show this in an example:
Consider a query:

Select emp_id from employee where dept_id ='HR'

In the above example, 'HR' is a scalar value.

You can replace 'HR' with another sql query:

Select emp_id from employee where dept_id = (select dept_id from Department where dt_name ='Human Resources')

As shown above, a popular application of orthogonality is sub-queries.

When you implement sub-queries as a special feature, you will get into all sorts of problems - like in Sybase - you need to explicitly specify where subqueries work and where they dont.

But if you implement Orthogonality as a concept inside your SQL engine, you will have an amazing flexibility in writing your sql statements. Subqueries just become an application of orthogonality.

Another example of orthogonality:

with t1(emp_id, emp_name) as
(values('E1', 'John Doe'),('E2','Jane Smith')) insert into Employee select * from T1

The Insert statement requires a vector of values. You can replace it by any other sql statement that yields a vector, as shown above.

Orthogonality and Closure are among most fundamental attributes of a good SQL implementation.

No other commercial database implements these two concepts as rigorously as DB2. This aspect is one of DB2's principal strengths. Received on Mon Jun 17 2002 - 02:43:23 CEST

Original text of this message