SQL query for values consisting of only a specific character
Select CustID,MAC_Addr From table_name Where MOD(MAC_Addr,9)=0;
Select CustID,MAC_Addr From table_name Where REGEXP_LIKE (MAC_Addr,'^[[:digit:]]+$') and MOD(MAC_Addr,9)=0;
Select CustID,MAC_Addr From table_name Where REGEXP_LIKE (MAC_Addr,'^[[:digit:]]+$') and MAC_Addr>0 and MOD(MAC_Addr,9)=0 ;
SQL select values containing only special characters
REGEXP to Find not only alphanum chars
SELECT c FROM yourTable
WHERE c NOT REGEXP '^[A-Za-z0-9]+$'
SQL server query to find values containing only special chars?
WHERE org Not like '%[a-Z0-9]%'
FROM (SELECT '1asdasdf' org
SELECT '$^%$%') a
WHERE org Not Like '%[a-Z0-9]%'
select values which contains specific characters in mysql
Where mycolumn like '%[en]%[en:]%'
and mycolumn like '%[hi]%[hi:]%'
Note that this query will not be very performant but that's what you get for not normalizing your database.
You could use a regex match to ensure not finding 'tags' that contain other tags like [en]foo[hi]bar[en:] but that would make performance even worse.
SQL query for finding rows with special characters only
Body LIKE '%[^0-9a-zA-Z ]%'
The stuff between the brackets says numbers (0-9), lowercase alphas (a-z), uppercase alphas (A-Z) and the space. The "^" makes that a "NOT" one of these things. Note that this is different though than NOT LIKE '%[0-9a-zA-Z ]%'
Filtering the Query to get string containing a constant followed by special character?
You could use
regexp_like with a regular expression:
WHERE REGEXP_LIKE(request_id, '^QWER[0-9]+$');