The underscores _
is to find occurrences at certain position of the string.
Let’s assume I’ll want to search every string that starts with my
.
LIKE 'my%'
Will return me records as: mySQL
, Myan
, Mylan
and etc.
Let’s start from the example I wanted to research my
but from the third position of the string.
LIKE '___my%'
Will return me records as hjjmy
, yuimy
and on.
There are other pattern matching
for the like as for example: \_
and even ESCAPE
.
Edit
Also to mark occurrences positions.
As in the example:
SELECT 'David!' LIKE '_____';
Will get output 0 because I searched for strings that contain 5 occurrences, already David!
contains 6 occurrences.
If I use:
SELECT 'David!' LIKE '______';
Will get output 1
Already expression:
SELECT 'David32' LIKE '_____\32';
Will confront if _____ 32 equals David32.
That is, 5 occurrences forward plus number 32 exists?
It will return all names containing 7 occurrences and the last two occurrences are: 32
References: http://dev.mysql.com/doc/refman/5.6/en/string-comparison-functions.html#operator_like
https://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html
Before criticizing me saying that I did not research: I did, and I did not find anything in Portuguese.
– Wallace Maxters
https://www.google.com/search?client=ubuntu&channel=fs&q=pra+que+serve+o+undescore+no+MSQL&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=J_T6VZOfG8aw8wfRhaL4Dw#safe=active&channel=fs&q=para+que+serve+o+underscore+no+MYSQL
– Wallace Maxters
Most search results are in English, not Portuguese. Try searching in English or looking in the manual itself, there responds directly. Sorry I don’t answer, I’m on my cell phone.
– juniorb2ss
Now we will have a source in Portuguese then - my question.
– Wallace Maxters
hauhau turn down for what!
– Daniel Omine
I had to use Google translator @Danielomine. And he said turn down to what!
– Wallace Maxters
this phrase is from a song and went viral. search on youtube that you will understand. hehe
– Daniel Omine