| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Is multi-type data in one field normal?
--CELKO-- wrote:
>>>Inspite of various claims, it is kind of normal to store different
Oh, I'm affraid you are in a great mistake here.
First of all you confound SQL with relational model, and of all people it is you that should be aware that SQL and relational model diverge in many essential ways. At best you can claim that SQL was inspired by the relational model.
Second the relational model is orthogonal to the type system used for the domains. Relational algebra and relational calculus deal with calculus over relations (which by the way is not supported in SQL).
Chris Date clarified this subject, both in his books, and in a not so old post on comp.database.theory.
I'm affraid that the kuldge you are referring to belong to the SQL standard itself. It is unacceptable in 2003, after 4 decades of advanced research in type theory, and after 30 years from the implementation of the first advanced type system *provably* sound, to "debate" about basic things like whether to support *boolean* as a data type, or even about a sum types.
Please have a break and at least read the very basic introduction: Robert Constable "Naive Type Theory", do you may get up to speed with what is all about.
>
>>>And don't pay too much attention to Mr. Celko's, his understanding
My collection of books on databases include books by Date, Abiteboul Hull & Vianu, Thalheim and a few others. I think it is enough until database theory advances a bit more.
So more to the point, if this is being done in SQL database, that is absolutely no justification for us to descend to the primitive level of the typical SQL database implementation. SQL is just a mean and not an end.
For example, SQL does not support proper relational model, that does not mean that we have a good excuse not to go by relational model, we can use the SQL DBMS as a lower level interface over which we can implement relational operators.
>
>>>He apparently has a lot of trouble to come to terms with the
Says, who ? Mr. Celko. Hmm :)
There is the notion of sum types and the term "sum" is not randomly chosen, it has a direct correspondent in category theory where you have the sum category, also it has an analogue in vectorial spaces where you have the sum space and in many other branches of mathematics.
if you want to stay ignorant of all these, be my guest, but my recommendation is for you to read at leats Robert Constable's introductory article, and if you are really curious you should buy the recent book "Type Theory" by Benjamin Pierce.
I do hope, for the sake of your readers (including here on usenet ), that you read more than you write.
>
>>>... you should design the solution the best you can, and then find
>>>To paraphrase the principle, you should not design your schema in
That's nice but that doesn't hide the fact that the kuldge belong to SQL as a standard and to SQL implementations.
>
>>>The fact that SQL's type system is limited should not prevent you
Again, your abuse of the term relational when you're talking abotu SQL, is at best funny.
>
>>>There's nothing wrong in principle with having a column that is a
In the case we're talking about the first column was all integers. And speking of that case you presented no satisfactory practical solution.
>
>>>Although it apparently "looks" bad it is a perfect "translation" of
You can bet modern languages make the sum type not only safe, but an essential instrument into expressing algorithms and data structure in an elegant and efficient way.
type 'a binTree=
Empty
| Node of 'a binTree * 'a * 'a binTree
This one is a tree of elments of type 'a (meaning any type can be substitude for `a) composed either from an empty node, or a node that is defined as the triple (left subtree, element in the node, right subtree)
type `a Maybe = NULL | Just of `a
These are just 2 examples of sum types, and they are even more important because they replace the *unsafe* use of NULL with a safe use of special marker.
>
> Because a database has to interface to any host language, present,
> past or future, it needs to have a fairly simple, HIGHLY portable type
> system. If you think SQL is bad, look at XML! Yet people work around
> its problems because they realize it is a transport language, not a
> database.
If that was true why not reduce SQL then to the level of C ? No that's not a good reason. Most of the programming languages in current don't support even the numeric types form SQL standard. Not to mention that inspite being unable to introduce basic "type constructors" like the sum type (aka union, but it is much more than the C union), they ventured into murky waters by specifying OBJECT features that no sane software engineer should ever want to use.
But with this attitude SQL is ready to become the next generation of COBOL, so I wonder why so much energy wasted in advocacy and counter-advocacy.
Is it worth it to prolong its life, because to evolve it in something better is quasi-impossible given its legacy, and already contorted design ? That might server our interests in the relaively short term as SQL is a useful tool for the time being.
Or else if we don't pull the plug in time on it we'll sooner or later find ourselves into such non-sense like declaring XML Schemas and doing XSL or XQL or who knows. ?
Costin Received on Thu Apr 17 2003 - 18:01:47 CDT
![]() |
![]() |