![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I still don't know if there is a better group to post general questions about SQL and the background. So I hope nobody minds ;-) My question is: Why do you have to state the GROUP BY explicitly in SQL? Why isn't it enough to write "select a_field, sum(b_field) from c_table;"? What additional value is generated by "group by a_field"? Thanks and best, Hans |
#3
| |||
| |||
|
|
Hello, I still don't know if there is a better group to post general questions about SQL and the background. So I hope nobody minds ;-) My question is: Why do you have to state the GROUP BY explicitly in SQL? Why isn't it enough to write "select a_field, sum(b_field) from c_table;"? What additional value is generated by "group by a_field"? Thanks and best, Hans |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hello, I still don't know if there is a better group to post general questions about SQL and the background. So I hope nobody minds ;-) My question is: Why do you have to state the GROUP BY explicitly in SQL? Why isn't it enough to write "select a_field, sum(b_field) from c_table;"? What additional value is generated by "group by a_field"? |
#6
| |||
| |||
|
|
Who can know how the original designers arrived at their decision? Probably because they believed in the myth of natural programming |
|
There were certainly other languages from the early SQL era (such as QUEL) that would allow a similar formulation to what you propose, meaning what you intend. *(And indeed QUEL would allow other sensible things with aggregates that SQL still doesn't easily allow.) Personally I imagine the logic of SQL aggregation got defined in haste, was "good enough", and they just moved swiftly on to the next challenge. A small team, internal IBM rivalries, publication demands, etc. finished the job. When looking at the grammar of the initial BS12, it seems obvious that |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Snipped. Who can know how the original designers arrived at their decision? Probably because they believed in the myth of natural programming languages. SQL is no exception. Dijskra clearly described the fundamental problem below... The virtue of formal texts is that their manipulations, in order to be legitimate, need to satisfy only a few simple rules; they are, when you come to think of it, an amazingly effective tool for ruling out all sorts of nonsense that, when we use our native tongues, are almost impossible to avoid. (http://www.cs.utexas.edu/~EWD/transc...xx/EWD667.html) There were certainly other languages from the early SQL era (such as QUEL) that would allow a similar formulation to what you propose, meaning what you intend. (And indeed QUEL would allow other sensible things with aggregates that SQL still doesn't easily allow.) Personally I imagine the logic of SQL aggregation got defined in haste, was "good enough", and they just moved swiftly on to the next challenge. A small team, internal IBM rivalries, publication demands, etc. finished the job. When looking at the grammar of the initial BS12, it seems obvious that we slowly shifted from a declarative oriented language to a verbose driven language. In BS12 the expresssion of aggregation was by the assignment of variables seprating the aggregates from the operation such as T1 = SUMMARY(EMP, GROUP(DEPTNUM), EMPS=COUNT, SALSUM=SUM(SALARY)) T2 = JOIN(T1, DEPT) T3 = SELECT(T2, SALSUM > BUDGET) comparing with SQL SELECT d.Deptnum, Count(*) as Emps, Sum(e.Salary) as Salsum, Budget FROM Emp as e JOIN Dept as d ON e.Deptnum = d.Deptnum GROUP BY d.Deptnum, Budget HAVING Sum(e.Salary) > Budget It is reasonnable to assume that the BS12 approach consisting of differentiating operations and presentation, while more abrupt, forced the programmer to understand better the underlying concepts. In other words, the introduction of *aesthetics* is one of the factors that killed SQL's chances to ever become a relational operation language. |
#9
| |||
| |||
|
|
BS12 was developped after IBM started having second thoughts about the massacre of System R massacre and *after* Oracle was on the way to build an empire. The context explained below http://www.mcjones.org/System_R/bs12.html gives very interesting clues about the context of that second attempt... ... |
#10
| ||||
| ||||
|
|
I suspect that what a 'TRDBMS' is, isn't yet fully known. *Lots of open questions, here're just a few: - Codd espoused logical data independence, yet by assuming some relations couldn't be updated in certain ways, he allowed a kind of contradiction, or at least a kind of dead-end. That is unclear. Unfortunately we can't ask Codd for that. |
|
- there is normalization theory to do with avoiding redundancy, but nothing comparable to do with avoiding ambiguity. Ambiguity is subjective. |
|
- where is the constraint theory? *will normalization turn out to be just a small part of this? I would not state exactly that way. I know for a fact that solving |
|
- is the ultimate interface a program that it is in effect a relation? Precisely. My point is that *only* a computing model can bring a |
![]() |
| Thread Tools | |
| Display Modes | |
| |