Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relationalalgebra - why did SQL become the industry standard?

Re: Extending my question. Was: The relational model and relationalalgebra - why did SQL become the industry standard?

From: Paul <pbrazier_at_cosmos-uk.co.uk>
Date: 14 Feb 2003 04:07:36 -0800
Message-ID: <51d64140.0302140407.11a55b43@posting.google.com>


"Bob Badour" <bbadour_at_golden.net> wrote in message news:<g8W2a.1405$Ay3.168203281_at_mantis.golden.net>...
> Some operations on relations require an explicit order: quota query, min,
> max etc.

Isn't there two separate issues here?
1) order on domains
2) order of tuples within a relation

The first would be generally desirable (not sure about things like image-valued domains though) and is needed for the MIN & MAX aggregate operations.

The second isn't really part of relational theory but appears to be needed for quota queries (I assume this is things like "SELECT TOP 5 * FROM emp ORDER BY salary"). Although thinking about it this ORDER BY is really different to the standard "SELECT * FROM emp ORDER BY salary":

The TOP 5 query still returns an unordered set in theory: although you get the top 5 salaries it wouldn't matter in what order those 5 were returned. In fact you can do these TOP-style queries using COUNT and subqueries I think, which is just about domain ordering. So really this ORDER BY is syntactic shorthand, which also deals with problems like ties etc.

The "SELECT * FROM emp ORDER BY salary" is different because it implies an order to the *relation* not just the domains of its attributes.

I suppose that in theory a query language could do without an ORDER BY and have any ordering done in the client application. But for physical reasons it would be more efficient for the DBMS to choose an optimization method that would output the rows in a specified order.

Paul. Received on Fri Feb 14 2003 - 06:07:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US