Re: SQL for presentation

From: J M Davitt <jdavitt_at_aeneas.net>
Date: Wed, 05 Jul 2006 13:54:51 GMT
Message-ID: <LwPqg.10775$Eh1.2128_at_tornado.ohiordc.rr.com>


frebe73_at_gmail.com wrote:
> At this forum, it is often claimed that almost all kind of data
> transformation could be done using SQL select statements.

I'm not sure that SQL is the best way to go and will presume that you mean some language consistent with relational theory. Given that, we probably wouldn't claim that all kinds of data transformation could be done using that language - simply the most reliable transformations.

  It is also
> claimed that the "business logic" should be implemented in the database
> as views and the application on top of the database only should be
> responsible for presentation (and communication).

Views are useful, but constraints shouldn't be ignored. Don't misunderstand the intent of things you've read here: the point is not to minimize the role of the application but rather to put features where they most reasonably belong. I think the argument you'll most often read is that data integrity and availability are increased when "business logic" is manifest in the database.

> In web applications, the presentation - HTML - is a data structure.

HTML is a markup language. I would hesitate to call it a structure simply because it has a hierarchic tag scheme. It certainly lacks the rigorous features that the relational model calls structure and uses to store and manipulate data.

> If
> select statements could make almost any kind of data transformation,
> why couldn't we use select statements to produce the HTML text?

As a matter of fact, two databases I've worked with do exactly that.

> I see a
> problem in the fact that HTML is hierachial and select statements
> doesn't seem suitable for returning hierachial results.

This puzzles me; what's difficult about "returning hierachial results?"

 > But what if a
> relational version of HTML existed, would the select statement be
> suitable for buildning the GUI too?

No. Select does what select does and GUI building isn't part of what select does. Building a BUI requires one to handle request/ response communications -- and that's certainly beyond what select does.

There are. however, those who envision applications built entirely from declarative language. Granted, not many exist and those that do are not sophisticated, but it's not clear that the goal is impossible. The difficulty is that very few people are able to work towards that goal.

>
> /Fredrik
>
Received on Wed Jul 05 2006 - 15:54:51 CEST

Original text of this message