# Hand-Holding at Scale

> The catalog is vast. Find what fraction of it is built for beginners.

Canonical URL: <https://datadriven.io/problems/tutorial_content_count>

Domain: SQL · Difficulty: easy · Seniority: L3

## Problem

The content team is assessing how much of the catalog is tutorial-focused. How many content items have 'tutorial' somewhere in the title?

## Worked solution and explanation

### Why this problem exists in real interviews

This tests pattern matching with `LIKE`. Interviewers check whether you know how to do a case-insensitive substring search and return a single aggregate count.

---

### Break down the requirements

#### Step 1: Match titles containing 'tutorial'

`WHERE LOWER(title) LIKE '%tutorial%'` finds all content items with 'tutorial' anywhere in the title, regardless of case.

#### Step 2: Count the matches

`COUNT(*)` returns the total number of matching items.

---

### The solution

**Case-insensitive pattern match with count**

```sql
SELECT COUNT(*) AS tutorial_count
FROM content_items
WHERE title LIKE '%tutorial%'
```

> **Cost Analysis**
>
> Full scan of 3M rows with a LIKE pattern. The leading `%` prevents index usage. For frequent queries, a full-text index or a computed column with LOWER(title) would help.

> **Interviewers Watch For**
>
> Whether the candidate considers case sensitivity. SQLite's LIKE is case-insensitive for ASCII by default, but other engines (PostgreSQL) require `ILIKE` or explicit `LOWER()`.

> **Common Pitfall**
>
> Using `= 'tutorial'` instead of `LIKE '%tutorial%'`. The exact match would miss titles like 'Advanced Tutorial: SQL Joins' or 'tutorial basics'.

---

## Common follow-up questions

- What if you needed the count per content_type? _(Add GROUP BY content_type to break down tutorials by format.)_
- How would you handle titles with HTML entities like '&amp;tutorial'? _(Tests data cleaning awareness before pattern matching.)_
- What if the search needed to match 'tutorials' (plural) as well? _(The LIKE '%tutorial%' pattern already matches 'tutorials' since it is a substring.)_

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/tutorial_content_count)
- [SQL Interview Questions](https://datadriven.io/sql-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.