Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 349509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:27:54+00:00 2026-05-12T11:27:54+00:00

My database looks like this: Book,Chapter,Verse,Scripture 1,1,1,1text1 1,1,2,1text2 1,1,3,1text3 1,1,4,1text4 1,2,1,2text1 1,2,2,2text2 1,2,3,2text3 I

  • 0

My database looks like this:

Book,Chapter,Verse,Scripture
"1","1","1","1text1"
"1","1","2","1text2"
"1","1","3","1text3"
"1","1","4","1text4"
"1","2","1","2text1"
"1","2","2","2text2"
"1","2","3","2text3"

I want to select all the rows from 1,1,1 to 1,2,3.

However my current query will not return row 1,1,4 because 4 is greater than 3.

SELECT * FROM my_table WHERE 
Book >= 1 AND Book <= 1 AND 
Chapter >= 1 AND Chapter <= 2 AND
Verse >= 1 AND Verse <= 3
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:27:54+00:00Added an answer on May 12, 2026 at 11:27 am

    MySQL also supports row constructors. If you wanted (e.g.) 1 1:3 through 1 2:2, use:

    SELECT * FROM bible
        WHERE (1,1,3) <= (book, chapter, verse) AND (book, chapter, verse) <= (1,2,2)
    

    For 58 1:3 to 62 4:2,

    SELECT * FROM bible
        WHERE (58,1,3) <= (book, chapter, verse) AND (book, chapter, verse) <= (62,4,2)
    

    58 1:4 will be included, as will 59 1:1 and 60 10:10, but not 62 5:1.

    I can’t find much documentation, but MySQL follows the behavior set down for row comparisons since SQL-92 (note: the link is to a draft version), specifically Section 8.2 “General Rules” 7):

    Let Rx and Ry be the two row value constructors of the comparison predicate and let Rxi and Ryi be the i-th row value constructor elements of Rx and Ry, respectively. “Rx [comp op] Ry” is true, false, or unknown as follows:
    […]
    c) “Rx < Ry” is true if and only if Rxi = Ryi for all i < n and Rxn < Ryn for some n.

    d) “Rx > Ry” is true if and only if Rxi = Ryi for all i < n and Rxn > Ryn for some n.

    e) “Rx <= Ry” is true if and only if Rx = Ry or Rx < Ry.

    f) “Rx >= Ry” is true if and only if Rx = Ry or Rx > Ry.

    Row comparisons are covered in section 9.2 Joe Celko’s SQL For Smarties (link is to 3rd Ed., but the same topic existed in earlier editions).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql database that looks like this: |id | city | created
I have a field called system in my database which looks like this system
say i have a nvarchar field in my database that looks like this 1,
My database structure looks something like this: Person Id Name FieldA FieldB Phone Id
I have a MySQL database table called Participant that looks something like this: (idParticipant)
I have an object hierarchy that looks something like this: public class Book {
I'm building an application with an underlying database that looks like a text-book example
In our system our database looks like this One agency has many brokerages, one
My database looks like this : Customer (c_id, c_name) Products (p_id, p_name, p_cost) Buys
My database looks like this... id, city, name 1, ajo, belly acres 2, alpine,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.