On Mon, Dec 13, 2010 at 9:04 AM, Puneet Kishor <[email protected]> wrote:

>
>
> steve mtangoo wrote:
> >   I have a  script that is supposed to query the Bible scriptures between
> two
> > intervals. My table is named Bible and have columns: ID (int), Book
> (int),
> > Chapter(int), Verse (int) and Scripture(text).
> >
> > Now the books are unique i.e. 1-66 but chapters keep repeating, and so do
> > verses. Now suppose I want to get scripture between book 1 chapter 1
> verse 1
> > and book 2 chapter 3 Verse 1, how do I go about?
>

Psalms has the most chapters (150) and Psalm 119 has the most verses (191).
So the chapter number and the verse number is always well less than 1000.
So you could encode each verse using a single integer (hint: making it the
INTEGER PRIMARY KEY):

    id = book_number*1000000 + chapter*1000 + verse.

The extracting a range of verses is a simple BETWEEN on the ID field.  And
the ID also works nicely as the DOCID for a full-text query.

This the approach taken in the SQLite database contained in the following
ZIP file:  http://www.sqlite.org/kjvbible_sqlite.zip


>
>
> SELECT Scripture
> FROM Bible
> WHERE
>     Book > 0 AND Book < 3 AND
>     Chapter > 0 AND Chapter < 4 AND
>     Verse > 0 AND Verse < 2
>
> > My knowledge of SQLite3
> > have taken me to a dead end!
>
> You need to acquire knowledge of SQL, not sqlite3. Google for tutorials.
>
> >
> > You can check how bible have its chapters and verses arranged at
> > www.biblegateway.com.
> >
> > Thanks!
> > _______________________________________________
> > sqlite-users mailing list
> > [email protected]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> --
> Puneet Kishor
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to