
- 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
Find integer in text data (comma separated values) with MySQL?
Let us first create a table −
mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> DoubleValue varchar(20) -> ); Query OK, 0 rows affected (0.58 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(DoubleValue) values('80.2,90.5,88.90'); Query OK, 1 row affected (0.44 sec) mysql> insert into DemoTable(DoubleValue) values('78.56,45.80,88,45.6'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(DoubleValue) values('12.34,90.06,89.90'); Query OK, 1 row affected (0.11 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+---------------------+ | Id | DoubleValue | +----+---------------------+ | 1 | 80.2,90.5,88.90 | | 2 | 78.56,45.80,88,45.6 | | 3 | 12.34,90.06,89.90 | +----+---------------------+ 3 rows in set (0.00 sec)
Here is the query to find an integer in text data −
mysql> select *from DemoTable where DoubleValue LIKE '%80%';
This will produce the following output −
+----+---------------------+ | Id | DoubleValue | +----+---------------------+ | 1 | 80.2,90.5,88.90 | | 2 | 78.56,45.80,88,45.6 | +----+---------------------+ 2 rows in set (0.00 sec)
- Related Articles
- Find specific records from a column with comma separated values in MySQL
- Count values from comma-separated field in MySQL?
- How to fetch random rows in MySQL with comma separated values?
- Fetch records from comma separated values using MySQL IN()?
- How to convert raw text to the CSV (Comma Separated Values) in PowerShell?
- How to search for particular strings between comma separated values in MySQL?
- MySQL query to search between comma separated values within one field?
- Remove specific word in a comma separated string with MySQL
- How to include quotes in comma separated column with MySQL?
- MySQL query to get string from one column and find its position in another column with comma separated values?
- How to change a data frame with comma separated values in columns to multiple columns in R?
- How to display data from a MySQL column separated by comma?
- How can I search within a table of comma-separated values in MySQL?
- How to convert comma separated text in div into separate lines with JavaScript?
- Display duplicate record as a distinct value with corresponding values as distinct comma separated list in MySQL?

Advertisements