Home > Mobile >  How to extract all rows of a single word
How to extract all rows of a single word

Time:01-05

I use PostgreSQL 13 on windows 10. I have a table with text-type columns. I'm looking for a query to find all the rows that contain just a single word is not accurate in a specific column.

Any ideas?

My table in database the form of, I try to extract all the rows with a single word.

enter image description here

output:

alvi
alexander
elmar
mahmoud

CodePudding user response:

you can try this :

SELECT Name
  FROM your_table
 WHERE Name ~ '^\w $'

see the power of the regular expressions in the manual

  •  Tags:  
  • Related