Suppose I have an imaginary table named bookInfo that contains the following values:
|id |book_name |description | ----------------------------------- |1 |book 1 |dummy | |2 |book 2 |harry | | | |potter | | | |Part 2 | |3 |...
The cell value for the description column of the second record ( id = 2 ) contains several sequences of newline characters between the keywords "harry" and "potter":
harry \n potter \n part 2
Is there a way to count the number of newline characters in the description column, for example. do the following:
SELECT (count new line)description FROM bookInfo WHERE id=2;
The previous request should return an integer value of 2 .
source share