Original address: The number of occurrences of a specified character in the SQL judgment field
Principle: Converts the specified character to null, the original length minus the converted length is the number of characters specified.
When doing data processing encountered a SQL operation problem is that there is a column of keywords field, the field contains a variety of messy characters, which has a double quotation mark "is not required in the keyword, so need to remove, and generally only with two" to remove, So first we have to find the double quotation marks and the double quotes two times, and then delete the values. This extracts the number of occurrences of the specified string in the field SQL is:
SELECT * FROM Google_keyword
where len (keyword)-len (replace (keyword, ' "', ')) =2
If you want to determine the number of occurrences of the specified string:
Select Count= (Len (field name)-len (replace (field name, ' Specify string ', '))/string length from TableName
Number of occurrences of the specified character in the SQL judgment field