LIKE query in Mysql

Asked

Viewed 48 times

0

How can I make a Mysql query that only searches for results that start with numbers and special characters, I know this is done with the LIKE, but I still don’t know how to get that result...

Example:

SELECT * FROM accounts
WHERE account_name LIKE '(qualquer caractere especial)%', LIKE '(qualquer número)%';
  • Here you have an answer, https://answall.com/questions/80793/query-usando-operator-like

  • so far I know, but I want to take only names that start with special characters and that start with numbers too

  • cite examples? which special characters?

  • It is any special character followed by anything like "(any special character)%" and numbers too, for example "(any number)%"

  • Try: REGEXP_LIKE(seu_campo, '^[^A-Z].+') = 0.

  • I was able to get the result

Show 1 more comment

2 answers

0

I think this might help:

SELECT * FROM accounts WHERE account_name LIKE '7%TERAÇÃO%'; // COMEÇA COM N°

SELECT * FROM accounts WHERE account_name LIKE 'Ç%TERAÇÃO%'; // COMEÇA COM CARACTER ESPECIAL

0


I was able to get the result through a REGEXP:

SELECT * FROM accounts
WHERE account_name RLIKE "^[^A-Z].+";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.