Re: Is SQL procedural or non-procedural?

From: J M Davitt <jdavitt_at_aeneas.net>
Date: Sun, 11 Jun 2006 12:10:58 GMT
Message-ID: <mLTig.56798$mh.25385_at_tornado.ohiordc.rr.com>


kumar.vaibhav.jain_at_gmail.com wrote:
> Hi,
>
> I am confused on this issue that wether SQL is procedural or non
> procedural. What are your views on this issue?
>
>
> Thanks,
>
> VJ
>

The unhelpful reply is, "Neither."

SQL is intended to be declarative; outside of syntactic requirements, the expressions used to describe a given set of rows and the order of those expressions should not matter. For the most part, that's true.

A notable (and troublesome) exception is found in the CASE construction: one has to be careful that the conditions to be evaluated are presented in the "correct" order.

Although not a language detail, one often hears that "performance can be improved" by writing SQL "differently." These recommendations usually amount to, "Get all the /x/ rows before joining to the /y/s and /z/s; it's faster." The whole exercise seems procedural. But fact that equivalent statements "perform" differently indicates a poor (or biased) physical design, poor administration, or a poor implementation. Received on Sun Jun 11 2006 - 14:10:58 CEST

Original text of this message