Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews.google.com!s16g2000cws.googlegroups.com!not-for-mail
From: "Cimode" <cimode@hotmail.com>
Newsgroups: comp.databases.theory
Subject: Re: Select enumeration of intergers
Date: 7 Jul 2006 02:40:24 -0700
Organization: http://groups.google.com
Lines: 39
Message-ID: <1152265224.804501.38500@s16g2000cws.googlegroups.com>
References: <1152203397.830774.247050@m38g2000cwc.googlegroups.com>
NNTP-Posting-Host: 195.154.188.107
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1152265228 7287 127.0.0.1 (7 Jul 2006 09:40:28 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 7 Jul 2006 09:40:28 +0000 (UTC)
In-Reply-To: <1152203397.830774.247050@m38g2000cwc.googlegroups.com>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.0 localhost:5656 (squid/2.5.STABLE11)
Complaints-To: groups-abuse@google.com
Injection-Info: s16g2000cws.googlegroups.com; posting-host=195.154.188.107;
   posting-account=XWbNBg0AAABXMdLVqoM3R9n-RIU90_cb
Xref: dp-news.maxwell.syr.edu comp.databases.theory:43144

To my knowledge, most implementation impose disks IO for this except
Oracle which does it a RAM level.  Maybe PostgresSQL?

frebe73@gmail.com wrote:
> I need to make a select statements according to this:
>
> select value
> from all_integers
> where value => 510 and value < 515
>
> The result should be:
> 510
> 511
> 512
> 513
> 514
>
> Any idea how to define the view "all_integers"? I prefer a solution for
> MySQL, but solution for other vendors would be appreciated too.
>
> I alread tried the solution below but the performance is too bad
>
> create view digits as
> select 0 as digit from dual
> union
> select 1 from dual
> union
> select 2 from dual
> ....
> union
> select 9 from dual
>
> create view all_integers as
> select
> d1.digit + d2.digit*10 + d3.digit*100 + .... + d10.digit*10000000000
> from digits d1, digits d2,  digits d3, .... , digits d4
> 
> /Fredrik

