bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 2738. Count Occurrences in Text

2738. Count Occurrences in Text

Leetcode Solutions

Distinct File Name Count Using REGEXP Operator

  1. Use the SELECT statement to create a constant column with the value 'bull'.
  2. Use the REGEXP operator within a CASE statement to check if the content column contains the standalone word 'bull' surrounded by spaces or at the beginning/end of a line.
  3. Use the SUM function to count the number of files where the standalone word 'bull' appears at least once.
  4. Repeat steps 1-3 for the standalone word 'bear'.
  5. Use the UNION operator to combine the results of the two SELECT statements into a single result set.
  6. Return the result set with the word and its corresponding count.
erDiagram
    Files {
        varchar file_name PK
        text content
    }

Total Occurrence Count Using String Matching with Spaces

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...