Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links


LIKE statement in MySQL

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-03-2010
Member
 
Join Date: Nov 2009
Posts: 518
LIKE statement in MySQL

Sponsored Links
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.

Reply With Quote
  #2  
Old 08-03-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,943
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.
Reply With Quote
  #3  
Old 08-03-2010
Member
 
Join Date: May 2008
Posts: 2,000
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).
Reply With Quote
  #4  
Old 08-03-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,989
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%';
Reply With Quote
  #5  
Old 08-03-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,278
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.
Reply With Quote
  #6  
Old 08-03-2010
Reegan's Avatar
Member
 
Join Date: Oct 2005
Posts: 2,381
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%';
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "LIKE statement in MySQL"
Thread Thread Starter Forum Replies Last Post
Unable to install MySQL and MySQL Workbench on Linux mint 10 Zared Windows Software 4 13-01-2011 12:08 AM
How to use JOIN statement in MySQL Atsushi Software Development 4 30-12-2010 05:31 AM
mysql config file in MySQL Netorious Software Development 4 18-03-2010 09:43 PM
Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 roshan45 Software Development 3 07-11-2009 08:36 PM
What is the difference between while statement & do statement? Athos Software Development 4 25-02-2009 07:52 PM


All times are GMT +5.5. The time now is 07:02 PM.