![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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)
Advertisements