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 8220139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:25:15+00:00 2026-06-07T13:25:15+00:00

I use the same query in my book. Then, why is my output much

  • 0

I use the same query in my book. Then, why is my output much different from that given in the book ?
The book also says “the || operator does not lead to the concatenation of alphanumeric values, but it is regarded as an OR operator to combine predicates”. What does the “an OR operator to combine predicates” mean ?

  • database: tennis
  • table: player
  • columns: playerno(pk), town, street, houseno …etc.

  • Problem:
    Get the player number and the address of each player who lives in stratford

  • Query:

    select playerno, town || '' || street || '' || houseno
    from players 
    where town = 'stratford';
    
  • Book’s result:

    2   Stratford Stoney Road 43
    6   Stratford Haseltine lane 80
    

……etc

  • My result(using the same query):

    2   1
    6   1
    7   1
    39  1
    57  1
    83  1
    100 1 
    
  • 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-06-07T13:25:17+00:00Added an answer on June 7, 2026 at 1:25 pm

    In MySQL, you have to use CONCAT() to bring the values of the columns together in one string:

    SELECT playerno, CONCAT(town, ' ', street, ' ', houseno)
    FROM   players 
    WHERE  town = 'stratford';
    

    Your book is perhaps referring to the Oracle concatenation syntax which uses || to concat strings. MySQL, by default, treats || as an OR operator between two or more conditions, returning 1 if either of them evaluate to “true”.

    But as noted in satdev86’s answer, MySQL does permit the use of || as a concatenation operator only if the mode PIPES_AS_CONCAT is manually set before you execute your query.


    EDIT:

    In your book, it clearly states you have to set the MySQL sql_mode for the examples to work. It’s on the page prior to your SQL example:

    http://books.google.com/books?id=c5G42OHT96cC&pg=PT160&lpg=PT160&dq=%22This+specification+is+needed+for+the+following+examples.+It+applies+only+to+the+current+session.%22&source=bl&ots=6b6zeFbM-2&sig=3a54S4vbgmKbPBqVbbR8OdxLLI8&hl=en&sa=X&ei=Nwz9T6fKAcfI2gWZhfDTBg&ved=0CCEQ6AEwAA

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

Sidebar

Related Questions

Is it available to write a query to use same LIMIT (from), (count), but
How can I use contains and iexact Field lookups at the same query in
Previously, I have an app that uses core data. I use same store url
I ran the same query in number of tables (containing different no of records):
When I make the same query twice, the second time it does not return
The query does not return value when I call it from ASP C# however
If I want to use the alias in the same query how do I
Trying to use a query with mongoexport results in an error. But the same
I am trying to use same validation function for all my controls. But I
Can the application use set same char in the XON and XOFF? If yes,

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.