O'Reilly Forums: Question On Between Clause - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Question On Between Clause

#1 User is offline   Cnes 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-September 12

Posted 10 September 2012 - 02:36 AM

Hi,

From the book, I learned that the below two queries should return the same result:

SELECT drink_name FROM easy_drinks WHERE main = 'peach nectar' OR main = 'soda';

SELECT drink_name FROM easy_drinks WHERE main BETWEEN 'P' AND main = 'S';

However, when I run the second query on the website, the result set doesn't contain the rows where main = 'soda'. Does anyone know why that is?
0

#2 User is offline   carlosgg123 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 12-May 13

Posted 13 May 2013 - 02:53 PM

Hi, the second query should be:

SELECT drink_name FROM easy_drinks WHERE main BETWEEN 'p' AND 't';

You have to use the letter after 's', see p. 108 example.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users