|type checking SQL expressions email@example.com (Jean Morissette) (2005-03-20)|
|Re: type checking SQL expressions firstname.lastname@example.org (George Neuner) (2005-03-24)|
|Re: type checking SQL expressions Brian.Inglis@SystematicSW.ab.ca (2005-03-25)|
|Re: type checking SQL expressions email@example.com (Gene Wirchenko) (2005-03-27)|
|Re: type checking SQL expressions Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2005-03-31)|
|Re: type checking SQL expressions firstname.lastname@example.org (Jean Morissette) (2005-04-11)|
|Re: type checking SQL expressions email@example.com (George Neuner) (2005-04-16)|
|From:||George Neuner <firstname.lastname@example.org>|
|Date:||24 Mar 2005 21:14:22 -0500|
|Posted-Date:||24 Mar 2005 21:14:22 EST|
On 20 Mar 2005 11:12:41 -0500, Jean Morissette
>I want to build a simple SQL compiler and I would like to know if a
>formal specification of the type system used in SQL has been written
If it has, I've never seen it. The types in a SQL query are ad hoc
and are completely defined by the constants in the query and the DDL
structure of the tables involved.
>It seems to me that the type system of SQL is incoherent.
>I let an exemple below that explain my affirmation.
>"SELECT column1 FROM table2 WHERE column3 > 9"
>the type of column3 is integer instead of tuple(integer)
It's not the type system - it's the syntax.
You're misunderstanding the query. The WHERE clause specifies that
any tuples to be included in the result set must satify a range
restriction on the value of column3.
Try reading it in relational pidgin:
project column1 from
table2 restricted by value(column3) > 9
You need to concern yourself with understanding the syntax of SQL and
what the query is really asking. You also need to understand the
various entities defined by the relational model and their
relationships to each other. I suggest, if you haven't already, that
you read up on the relational model, relational algebra and on the SQL
implementation of them.
Return to the
Search the comp.compilers archives again.