Thread

  1. Re: [GENERAL] LIKE (SQL operator)

    Brett W. McCoy <bmccoy@lan2wan.com> — 1998-06-29T14:27:12Z

    On Mon, 29 Jun 1998, Joao Paulo Felix wrote:
    
    > I have a table called "products" which has a field named "item" with
    > following data stored:
    > 
    > "item"
    > PR1000
    > PR2000
    > PR3000
    > PRZE10
    > Lze100
    > Beta 
    > Teta
    > 
    > Does PostgreSQL support the SQL operator "LIKE" . I have unsuccessfully
    > trying the following SQL query:
    > 
    > (SELECT * FROM products WHERE item LIKE '*PR*')
    > 
    > I would like to select all the rows where the field "item" has the
    > substring "PR" inside it.
    
    Yes, you would use it thusly:
    
    SELECT * FROM products WHERE item LIKE '%PR%';
    
    The wildcards are '%' and '_', which function the same as '*' and '?',
    respectively.
    
    Brett W. McCoy           
                                            http://www.lan2wan.com/~bmccoy/
    -----------------------------------------------------------------------
    "The number of UNIX installations has grown to 10, with more expected."
       -- The UNIX Programmer's Manual, 2nd Edition, June, 1972
    
    
    
  2. LIKE (SQL operator)

    Joao Paulo Felix <felix@cyclades.com> — 1998-06-30T02:10:57Z

    Hello there,
    
    I have a table called "products" which has a field named "item" with
    following data stored:
    
    "item"
    PR1000
    PR2000
    PR3000
    PRZE10
    Lze100
    Beta 
    Teta
    
    Does PostgreSQL support the SQL operator "LIKE" . I have unsuccessfully
    trying the following SQL query:
    
    (SELECT * FROM products WHERE item LIKE '*PR*')
    
    I would like to select all the rows where the field "item" has the
    substring "PR" inside it.
    
    Thanks in advance for any pointers/help'
    
    JP
    -- 
    ________________________________________________________________
    
    Joao Paulo Felix 
    
    Cyclades Corporation                    voice: (510) 770-9727
    41934 Christy Street                    fax: (510) 770-0355
    Fremont, CA                             www.cyclades.com
    ________________________________________________________________
    
    
  3. Re: [GENERAL] LIKE (SQL operator)

    Marc G. Fournier <scrappy@hub.org> — 1998-06-30T02:29:19Z

    On Mon, 29 Jun 1998, Joao Paulo Felix wrote:
    
    > Hello there,
    > 
    > I have a table called "products" which has a field named "item" with
    > following data stored:
    > 
    > "item"
    > PR1000
    > PR2000
    > PR3000
    > PRZE10
    > Lze100
    > Beta 
    > Teta
    > 
    > Does PostgreSQL support the SQL operator "LIKE" . I have unsuccessfully
    > trying the following SQL query:
    > 
    > (SELECT * FROM products WHERE item LIKE '*PR*')
    
    SELECT * FROM products WHERE item LIKE '%PR%'
    
    
    Marc G. Fournier                                
    Systems Administrator @ hub.org 
    primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org