

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Select words from a text already in a MySQL table
Let us first create a table −
mysql> create table DemoTable1316 -> ( -> Value varchar(40) -> ); Query OK, 0 rows affected (0.47 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1316 values('MySQL'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1316 values('Java'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1316 values('MongoDB'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable1316 values('C++'); Query OK, 1 row affected (0.13 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable1316;
This will produce the following output. These are the words we need to select later and find in a text −
+---------+ | Value | +---------+ | MySQL | | Java | | MongoDB | | C++ | +---------+ 4 rows in set (0.00 sec)
Following is the query to select words in the above table from the text “Deep Dive using Java is good for advanced knowledge, but not MySQL” −
mysql> select Value -> from DemoTable1316 -> where ( 'Deep Dive using Java is good for advanced knowledge, but not MySQL') like concat('%',Value,'%');
Output
+-------+ | Value | +-------+ | MySQL | | Java | +-------+ 2 rows in set (0.05 sec)
- Related Questions & Answers
- Create a MySQL table from already created table selecting specific rows?
- How to add a column using MySQL SELECT in an already created table?
- Insert values in a table by MySQL SELECT from another table in MySQL?
- MySQL select query to select rows from a table that are not in another table?
- Select total from a MySQL table based on month
- MySQL select distinct dates from datetime column in a table?
- Select rows from a MySQL table and display using IN()
- Select a fixed number of random records from a MySQL table?
- How to check an empty table already in a MySQL database?
- Update only a single value from a MySQL table where select from same table ordered in descending order?
- How to select from MySQL table A that does not exist in table B?
- MySQL SELECT from table A that does not exist in table B using JOINS?
- Select records from a table on the basis of keywords in MySQL
- Select date from MySQL and format to text?
- Randomly SELECT distinct rows in a MySQL table?
Advertisements