Select in varchar column containing only one word

Asked

Viewed 50 times

1

How to run a SELECT SQL that only looks for VARCHAR type results that contain only one word? That is, I don’t want results with more than one word

  • 1

    How to ask a good question? Go to https://answall.com/help/how-to-ask

  • 2

    Suppose when the field has more than one word they are separated by space then use NOT LIKE '% %'.

  • Geniiaaal of space, I hadn’t thought of that!

  • 1

    With some functions it is possible to check: CHARACTER_LENGTH(Your column) the 'numcharacters', SUBSTRING_INDEX(SUBSTRING_INDEX(Your column, ', ', 1), ', -1) AS primeironome ,TRIM( SUBSTR(Suacoluna, LOCATE(' ', Suacoluna)) AS last name, if(TRIM( SUBSTR(Your column, LOCATE(' ', Your column)) = '','CONTAINS FIRST','HAS SECOND NAME') THE CHECKS

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.