Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search for value within BLOB column in MySQL

How can I search inside Blob column in MySQL for some values ? and Is that possible ?

like image 488
Zamblek Avatar asked Sep 19 '10 17:09

Zamblek


People also ask

What is BLOB value in MySQL?

A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are TINYBLOB , BLOB , MEDIUMBLOB , and LONGBLOB . These differ only in the maximum length of the values they can hold. The four TEXT types are TINYTEXT , TEXT , MEDIUMTEXT , and LONGTEXT .


1 Answers

You should be able to search blobs like other text fields:

SELECT * 
FROM tablename 
WHERE blob_field_name LIKE '%value%'

One thing to notice is that search will be case-sensitive!

Anyway, if possible, it's better to use a TEXT field.

like image 150
Zilverdistel Avatar answered Oct 03 '22 07:10

Zilverdistel