
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Integer in Text Data 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)
Advertisements