Results 1 to 4 of 4

Thread: Search Query

  1. #1
    Join Date
    Jan 2004
    Posts
    25

    Unanswered: Search Query

    I have the following table called Test with the following columns.

    Items
    ---------
    pest
    best
    test
    destruct


    Is there anyway of selecting everything in the table if i do a search for est? Meaning, i wanna select any items containing 'est'. Is there a possible SQL statement for it? Thanks.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    use the LIKE statement:

    where column-name like '%est%'

    See the SQL Reference for more details on LIKE and the use of % and _.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2004
    Location
    Europe, Finland, Helsinki
    Posts
    64
    Originally posted by Marcus_A
    use the LIKE statement:

    where column-name like '%est%'

    See the SQL Reference for more details on LIKE and the use of % and _.
    Hi

    One word of caution. Doing a search like that into big table will cause an index space scan & a major performance 'hog'. We have one like this in our company (OS/390 environment), and it's a real PROBLEM.

    Cheers, Bill

  4. #4
    Join Date
    Jan 2004
    Posts
    25
    Thanks for the caution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •