
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we use FIND_IN_SET() function with MySQL WHERE clause?
When we use FIND_IN_SET() function in WHERE clause then it searches the search string within the given string as specified in the argument and retrieves all the columns from concerned rows. Following is an example to demonstrate it −
Example
In this example, we are getting the columns from ‘Student’ table where the rows have the value of name as ‘Gaurav’. Here the FIND_IN_SET() function will search the search string ‘Gaurav’ from the values of column ‘Name’.
mysql> Select Id, Name, Address, Subject from student WHERE FIND_IN_SET('Gaurav',Name); +------+--------+---------+-----------+ | Id | Name | Address | Subject | +------+--------+---------+-----------+ | 1 | Gaurav | Delhi | Computers | | 20 | Gaurav | Jaipur | Computers | +------+--------+---------+-----------+ 2 rows in set (0.20 sec)
- Related Articles
- How can we use ASCII() function with MySQL WHERE clause?
- How can we use CHAR_LENGTH() function with MySQL WHERE clause?
- How can we use BIN() function with MySQL WHERE clause?
- How can we use MySQL INSTR() function with WHERE clause?
- How Can we use MySQL DISTINCT clause with WHERE and LIMIT clause?
- How can we use two columns with MySQL WHERE clause?
- How can I use SPACE() function with MySQL WHERE clause?
- How can we use MySQL REVERSE() function on column’s data along with WHERE clause?
- How can we use WHERE clause with MySQL INSERT INTO command?
- How can we use MySQL SUM() function with HAVING clause?
- Can we use the result of a SUM() function in MySQL WHERE clause
- Can we use WHERE clause inside MySQL CASE statement?
- How can CONCAT() function be used with MySQL WHERE clause?
- How can CONCAT_WS() function be used with MySQL WHERE clause?
- How LOCATE() function can be used with MySQL WHERE clause?

Advertisements