Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: formal SQL typing rules

Re: formal SQL typing rules

From: Brian Inglis <Brian.Inglis_at_SystematicSW.Invalid>
Date: Mon, 28 Mar 2005 21:02:09 GMT
Message-ID: <o2sg41lkm09qpq29s3ohoovomufikl7uk2@4ax.com>


On Sat, 26 Mar 2005 17:22:50 -0500 in alt.comp.databases, Jean Morissette <jean.morissette666_at_videotron.ca> wrote:

>Hi,
>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
>somewhere? I have read the SQL99 ISO spec, but they don't talk about typing
>rules!
>
>Currently, I'm trying to figure myself these typing rules and I would like
>to have your comments...
>
>
>First, I have defined some types of SQL by the following grammar:
>
> t ::= int | float | bool | char | string
> | t x ... x t -> t
> | bag(t) | set(t) | list(t)
>
>Next, I have defined some rules for deriving the type of a query:
>
>
>1.
>Informally, the type of the result of
> SELECT column_1,...,column_n FROM table_list WHERE predicate
>must be
> bag(tuple(t1,...,tn))
>where 't1' is the type of 'column_1' and 'tn' is the 'type of column_n'.
>
>
>2.
>Also, informally, the type of column_1
> ... WHERE column_1 IN subquery
>must be
> tuple(t1)
>if the type of subquery is
> bag(tuple(t1)).
>
>
>If these two rules are exacts, what should be the type of 'column1' in this
>expression
> ... WHERE column_1 > 666
>
>Here, the type of 'column_1' is 'int' or 'float'. Note that 'column_1' type
>cannot be equal to 'tuple(int)' or 'tuple(float)' like it was in the
>previous rule. So, it seems to me that the type of an expression is
>context dependant. Am I right?
>
>
>Thank for your comment
>-Jean

[sorry, gave you a bum steer to a.c.d, meant c.d.t, f-ups set]

-- 
Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada

Brian.Inglis_at_CSi.com 	(Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
    fake address		use address above to reply
Received on Mon Mar 28 2005 - 15:02:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US