SQL query for values consisting of only a specific character
Select CustID,MAC_Addr From table_name Where MOD(MAC_Addr,9)=0;
EDIT:
Select CustID,MAC_Addr From table_name Where REGEXP_LIKE (MAC_Addr,'^[[:digit:]]+$') and MOD(MAC_Addr,9)=0;
EDIT:2
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
Using REGEXP
to Find not only alphanum chars
SELECT c FROM yourTable
WHERE c NOT REGEXP '^[A-Za-z0-9]+$'
SQLFiddle
SQL server query to find values containing only special chars?
Try this
SELECT org
FROM table_A
WHERE org Not like '%[a-Z0-9]%'
Demo
SELECT org
FROM (SELECT '1asdasdf' org
UNION
SELECT '$asd#'
UNION
SELECT '$^%$%') a
WHERE org Not Like '%[a-Z0-9]%'
Result: $^%$%
select values which contains specific characters in mysql
Select *
From mytable
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
SELECT
TemplateID,
Body
FROM
#Template
WHERE
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:
SELECT *
FROM c
WHERE REGEXP_LIKE(request_id, '^QWER[0-9]+$');
Related Topics
Sql Merge Two Rows With Same Id But Different Column Values (Oracle)
Mysql - Move Rows from One Table to Another
How to Merge Rows on Specific Condition
Checking a Column If It Contains a Row Value
Sql: How to Get Both Match and Non-Match Records
How to Use Select Distinct and Concat in the Same SQL Statement
Access Denied for Load Data Infile in MySQL
Add a Column to Specific Position in Mssql Server
Simple Check for Select Query Empty Result
Query to Calculate Average of Employee Salaries Working Under Manager in SQL
Node.Js Mssql Tedius Connectionerror: Failed to Connect to Localhost:1433 - Connect Econnrefused
Find a Matching Value in Date Range and Return Value
Left Join Without Duplicate Rows from Left Table
The Network Adapter Could Not Establish the Connection in SQL Developer
Row Numbers in Query Result Using Microsoft Access