Query in a certain string

1
I would like to know how to do a query in the database of a certain string, for example I would like in the field "name", I would like to make a query by name: vinicios, and would like to return all the records that contain the name vices regardless of whether they are vinicios cardoso, vinicios antonio, etc.

    
asked by anonymous 26.02.2016 / 02:02

1 answer

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

The% symbol indicates that there may be anything, that is, any name containing vinicius before or after will be selected.

To search for all names beginning with Vinicius for example, you would do the following:

 select * from nome_da_tabela where nome like 'vinicius%'
    
26.02.2016 / 02:38