The following query returns a result of 2. The 3-grams 'mit' and 'ith' match. 'Smi' and 'smi' do not match because of the difference in case.
SELECT NGRAM('John Smith','Allen smith 1',3);
The following query returns a result of zero. There are no 3-grams in the first string expression of '' because the length of the string is less than 3.
SELECT NGRAM ('','str1 empty',3);
The following query returns a result of zero. There are no 0-grams in the strings.
SELECT NGRAM ('test with zero length', 'test with zero length',0);
The following query returns a result of 3. The 1-grams 'a', 'b', and 'c' match.
SELECT NGRAM ('abc','yyabc',1);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match.
SELECT NGRAM ('abc','yyabc',2);
The following query returns a result of zero. The 2-grams 'ab' and 'bc' match, but are not within 1 position of each other.
SELECT NGRAM ('abc','yyabc',2, 1);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match, and are within 2 positions of each other.
SELECT NGRAM ('abc','yyabc',2, 2);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match, and are at the same position in each string.
SELECT NGRAM ('abc','abc',2, 0);
The following query returns a result of zero. There are no 5-grams because the length of either input string is less than 5.
SELECT NGRAM ('abc','abc',5,0);
The following query returns a result of zero. There are no 3-grams in the first string expression of '' because the length of the string is less than 3.
SELECT NGRAM ('','str1 empty',3);
The following query returns a result of zero. There are no 0-grams in the strings.
SELECT NGRAM ('test with zero length', 'test with zero length',0);
The following query returns a result of 3. The 1-grams 'a', 'b', and 'c' match.
SELECT NGRAM ('abc','yyabc',1);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match.
SELECT NGRAM ('abc','yyabc',2);
The following query returns a result of zero. The 2-grams 'ab' and 'bc' match, but are not within 1 position of each other.
SELECT NGRAM ('abc','yyabc',2, 1);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match, and are within 2 positions of each other.
SELECT NGRAM ('abc','yyabc',2, 2);
The following query returns a result of 2. The 2-grams 'ab' and 'bc' match, and are at the same position in each string.
SELECT NGRAM ('abc','abc',2, 0);
The following query returns a result of zero. There are no 5-grams because the length of either input string is less than 5.
SELECT NGRAM ('abc','abc',5,0);