Query in a given string

Asked

Viewed 42 times

1

Good staff my question is the following: I would like to know how to make a query in the database of certain string, for example I would like to in the field "name", I would like to make a query by name: Home, and I would like you to return to me all the records that contain the name vicious regardless of being Home, Home, Home, etc.

  • 1

    2 negative, beauty, now just tells me why they have negative.

  • Try using the LIKE operator

1 answer

1


  select * from nome_da_tabela where nome like '%vinicius%'

The % symbol indicates that there can be anything, that is, any name that contains Vinicius before or after will be selected.

To search all the names that start with Vinicius for example, you would do as follows:

 select * from nome_da_tabela where nome like 'vinicius%'
  • Thank you :)....

Browser other questions tagged

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