Results 1 to 6 of 6

Thread: LIKE statement in MySQL

  1. #1
    Join Date
    Nov 2009
    Posts
    518

    LIKE statement in MySQL

    Hello ,

    i want to know about the searching criteria of records from database object in MySQL database.As a new for MySQL,I am going to write a query and I need to add the searching criteria according to the range and case of the record.

    How can it would be possible.please help me regarding this.

    Thank.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    LIKE statement in MySQL

    The searching criteria is specified for every database in the database management system.If you didn't specify the matching criteria for records in the database.In case,you can't be facilitate from the database.

    Different database uses the searching criteria and every one has some little bit changes in the syntax to define them.If we talk about the MySQL database.It uses the LIKE statement to fetch the records from the database tables.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    LIKE statement in MySQL

    If you need to show all the products from the table "Product_data" that contain the words JACK as the name of supplier.You can use the wildcard search pattern to display the name of that particular person in the table.

    There are two wildcard characters are used and I think,the popular database also usage the same for pattern matching.The wild card characters are as follows-

    1- % (percentage sign character).
    2- _ (Underscore character).

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Use of % Wildcard with LIKE statement

    Use of % Wildcard :

    One of the wild card named percentage sign wild card is used to disply

    The most commonly used wildcard is the percent sign (%).This character is used with the search string, % specifies that match any number of occurrences of any character. For example,A table named Products and contains too many rows and I need to find all the name of products that start with the word MAN.
    To find that required product,you can use the following SELECT statement:

    Code:
    SELECT pd_id, pd_name
    FROM products
    WHERE prod_name LIKE 'MAN%';

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Use of (_) with LIKE statement

    Use of Underscore (_) wild card :

    This is one of the useful wildcard named underscore (_). The underscore is used just like %, but act some different from %. the % matches multiple characters where as the underscore matches within a single character.

    The example can given below can clarify,what happens behind this.execute the following statement in your MySQL terminal.

    Code:
    SELECT pd_id, pd_name
    FROM products
    WHERE prod_name LIKE '_MAN';
    It will display only those record which can be started with any character but the second character must be MAN.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Accessing cookies using LIKE statement

    Accessing cookies using LIKE statement

    If you are using the MySQL as a back end for your web application then you access the cookies of the website that you have developed.

    The following statement would allow to access the data from cookies of the website.

    Code:
    mysql> SELECT * FROM search WHERE Keywords LIKE '%cookies%';

Similar Threads

  1. Replies: 4
    Last Post: 13-01-2011, 01:08 AM
  2. How to use JOIN statement in MySQL
    By Atsushi in forum Software Development
    Replies: 4
    Last Post: 30-12-2010, 06:31 AM
  3. mysql config file in MySQL
    By Netorious in forum Software Development
    Replies: 4
    Last Post: 18-03-2010, 09:43 PM
  4. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  5. Replies: 4
    Last Post: 25-02-2009, 08:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,871,931.66746 seconds with 17 queries