find a string contained in an attribute
find a string contained in an attribute
От:
Karina Guardado <kguardado@gmail.com>
Дата:
Hi,
I want to know if it is possible to search for a string of characters inside an attribute for example I have the following table and values
cod_unidad | nombre_uni
------------+---------------------------------------------
1 | Facultad de Ciencias Naturales y Matemática
2 | Facultad de Ciencias Humanidades
3 | Facultad de Ingeniería
4 | Facultad de Agronomía
5 | Oficinas Centrales
6 | test
I want to retrieve all the rows where I find the word Ciencias for example. Is there a function or with select is possible to do it?
thanks in advance,
karina
El Salvador, Centroamerica
I want to know if it is possible to search for a string of characters inside an attribute for example I have the following table and values
cod_unidad | nombre_uni
------------+---------------------------------------------
1 | Facultad de Ciencias Naturales y Matemática
2 | Facultad de Ciencias Humanidades
3 | Facultad de Ingeniería
4 | Facultad de Agronomía
5 | Oficinas Centrales
6 | test
I want to retrieve all the rows where I find the word Ciencias for example. Is there a function or with select is possible to do it?
thanks in advance,
karina
El Salvador, Centroamerica
Re: find a string contained in an attribute
От:
Szymon Guz <mabewlun@gmail.com>
Дата:
2010/3/24 Karina Guardado <kguardado@gmail.com>
Hi,
I want to know if it is possible to search for a string of characters inside an attribute for example I have the following table and values
cod_unidad | nombre_uni
------------+---------------------------------------------
1 | Facultad de Ciencias Naturales y Matemática
2 | Facultad de Ciencias Humanidades
3 | Facultad de Ingeniería
4 | Facultad de Agronomía
5 | Oficinas Centrales
6 | test
I want to retrieve all the rows where I find the word Ciencias for example. Is there a function or with select is possible to do it?
thanks in advance,
karina
El Salvador, Centroamerica
For example something like this should work:
SELECT * FROM table WHERE nombre_uni like '%Ciencias%';
more you can find here: http://www.postgresql.org/docs/8.4/interactive/functions-matching.html
regards
Szymon Guz
Re: find a string contained in an attribute
От:
Karina Guardado <kguardado@gmail.com>
Дата:
Thanks a lot for your help that's exactly what I wanted. It worked fine.
regards,
karina
regards,
karina
On Wed, Mar 24, 2010 at 3:25 PM, Szymon Guz <mabewlun@gmail.com> wrote:
2010/3/24 Karina Guardado <kguardado@gmail.com>Hi,
I want to know if it is possible to search for a string of characters inside an attribute for example I have the following table and values
cod_unidad | nombre_uni
------------+---------------------------------------------
1 | Facultad de Ciencias Naturales y Matemática
2 | Facultad de Ciencias Humanidades
3 | Facultad de Ingeniería
4 | Facultad de Agronomía
5 | Oficinas Centrales
6 | test
I want to retrieve all the rows where I find the word Ciencias for example. Is there a function or with select is possible to do it?
thanks in advance,
karina
El Salvador, CentroamericaFor example something like this should work:SELECT * FROM table WHERE nombre_uni like '%Ciencias%';more you can find here: http://www.postgresql.org/docs/8.4/interactive/functions-matching.htmlregardsSzymon Guz
Re: find a string contained in an attribute
От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
2010/3/24 Szymon Guz :
> 2010/3/24 Karina Guardado
>>
>> Hi,
>>
>> I want to know if it is possible to search for a string of characters
>> inside an attribute for example I have the following table and values
>>
>> cod_unidad | nombre_uni
>> ------------+---------------------------------------------
>> 1 | Facultad de Ciencias Naturales y Matemática
>> 2 | Facultad de Ciencias Humanidades
>> 3 | Facultad de Ingeniería
>> 4 | Facultad de Agronomía
>> 5 | Oficinas Centrales
>> 6 | test
>>
>>
>> I want to retrieve all the rows where I find the word Ciencias for
>> example. Is there a function or with select is possible to do it?
>>
>> thanks in advance,
>>
>> karina
>> El Salvador, Centroamerica
>
> For example something like this should work:
> SELECT * FROM table WHERE nombre_uni like '%Ciencias%';
> more you can find
> here: http://www.postgresql.org/docs/8.4/interactive/functions-matching.html
> regards
> Szymon Guz
better to use a fulltext it is much faster on tables larger than small
create index foo on tab using gin(to_tsvector('simple', nombre_uni))
select * from tab where to_tsvector('simple', nombre_uni) @@
to_tsquery('simple', 'Ciencias');
Regards
Pavel Stehule
Re: find a string contained in an attribute
От:
Karina Guardado <kguardado@gmail.com>
Дата:
Do you have a link where I can read more about this because is not easy to understand.
Thanks for your help,
karina
Thanks for your help,
karina
On Thu, Mar 25, 2010 at 1:34 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
2010/3/24 Szymon Guz <mabewlun@gmail.com>:better to use a fulltext it is much faster on tables larger than small> 2010/3/24 Karina Guardado <kguardado@gmail.com>
>>
>> Hi,
>>
>> I want to know if it is possible to search for a string of characters
>> inside an attribute for example I have the following table and values
>>
>> cod_unidad | nombre_uni
>> ------------+---------------------------------------------
>> 1 | Facultad de Ciencias Naturales y Matemática
>> 2 | Facultad de Ciencias Humanidades
>> 3 | Facultad de Ingeniería
>> 4 | Facultad de Agronomía
>> 5 | Oficinas Centrales
>> 6 | test
>>
>>
>> I want to retrieve all the rows where I find the word Ciencias for
>> example. Is there a function or with select is possible to do it?
>>
>> thanks in advance,
>>
>> karina
>> El Salvador, Centroamerica
>
> For example something like this should work:
> SELECT * FROM table WHERE nombre_uni like '%Ciencias%';
> more you can find
> here: http://www.postgresql.org/docs/8.4/interactive/functions-matching.html
> regards
> Szymon Guz
create index foo on tab using gin(to_tsvector('simple', nombre_uni))
select * from tab where to_tsvector('simple', nombre_uni) @@
to_tsquery('simple', 'Ciencias');
Regards
Pavel Stehule
Re: find a string contained in an attribute
От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
http://www.postgresql.org/docs/8.4/static/textsearch.html
Regards
Pavel Stehule
2010/3/25 Karina Guardado :
> Do you have a link where I can read more about this because is not easy to
> understand.
>
> Thanks for your help,
>
> karina
>
> On Thu, Mar 25, 2010 at 1:34 AM, Pavel Stehule
> wrote:
>>
>> 2010/3/24 Szymon Guz :
>> > 2010/3/24 Karina Guardado
>> >>
>> >> Hi,
>> >>
>> >> I want to know if it is possible to search for a string of characters
>> >> inside an attribute for example I have the following table and values
>> >>
>> >> cod_unidad | nombre_uni
>> >> ------------+---------------------------------------------
>> >> 1 | Facultad de Ciencias Naturales y Matemática
>> >> 2 | Facultad de Ciencias Humanidades
>> >> 3 | Facultad de Ingeniería
>> >> 4 | Facultad de Agronomía
>> >> 5 | Oficinas Centrales
>> >> 6 | test
>> >>
>> >>
>> >> I want to retrieve all the rows where I find the word Ciencias for
>> >> example. Is there a function or with select is possible to do it?
>> >>
>> >> thanks in advance,
>> >>
>> >> karina
>> >> El Salvador, Centroamerica
>> >
>> > For example something like this should work:
>> > SELECT * FROM table WHERE nombre_uni like '%Ciencias%';
>> > more you can find
>> >
>> > here: http://www.postgresql.org/docs/8.4/interactive/functions-matching.html
>> > regards
>> > Szymon Guz
>>
>> better to use a fulltext it is much faster on tables larger than small
>>
>> create index foo on tab using gin(to_tsvector('simple', nombre_uni))
>>
>> select * from tab where to_tsvector('simple', nombre_uni) @@
>> to_tsquery('simple', 'Ciencias');
>>
>> Regards
>> Pavel Stehule
>
>