
- 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 MySQL FIND_IN_SET() function be used to get the particular record(s) from the table as a result set?
We can get the record(s) as a result set by providing the particular string and name of the column as arguments of FIND_IN_SET() function. We also need to use WHERE clause with FIND_IN_SET() function. To understand it, we are using the data, given as below, from table ‘student_info’:
mysql> Select * from student_info; +------+---------+----------+------------+ | id | Name | Address | Subject | +------+---------+----------+------------+ | 101 | YashPal | Amritsar | History | | 105 | Gaurav | Jaipur | Literature | | 125 | Raman | Shimla | Computers | +------+---------+----------+------------+ 3 rows in set (0.00 sec)
Now, following query will use FIND_IN_SET() function to get particular records as result set having the name of the student as ‘Raman’:
mysql> Select Id, Name, Subject from Student_info Where FIND_IN_SET('Raman',Name); +------+-------+-----------+ | Id | Name | Subject | +------+-------+-----------+ | 125 | Raman | Computers | +------+-------+-----------+ 1 row in set (0.00 sec)
- Related Articles
- How can I get the records from MySQL table in result set in a particular way?
- How to get the second last record from a table in MySQL?
- How can we fetch a particular row as output from a MySQL table?
- How can we fetch all the records from a particular MySQL table?
- In MySQL, how FIELD() function is different from FIND_IN_SET() function?
- How can we get all the unique rows in MySQL result set?
- Get the last record from a table in MySQL database with Java?
- How to get the top 3 salaries from a MySQL table with record of Employee Salaries?
- When MySQL FIND_IN_SET() function returns NULL as output?
- How can we search a record from MySQL table having a date as a value in it?
- How can we find out the storage engine used for a particular table in MySQL?
- How MySQL CONCAT() function, applied to the column/s of a table, can be combined with the column/s of other tables?
- How can MySQL COALESCE() function be used with MySQL SUM() function to customize the output?
- How to make MySQL result set the same as specified?
- How can we use FIND_IN_SET() function with MySQL WHERE clause?

Advertisements