# Content Types by Creator

> One creator. What did they make?

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

Domain: SQL · Difficulty: easy · Seniority: L3

## Problem

The editorial lead is reviewing creator 100's output. What content types has this creator produced? Return the types with no duplicates.

## Worked solution and explanation

### Why this problem exists in real interviews

This is a simple DISTINCT filter query. It tests the ability to filter by a specific value and deduplicate results.

---

### Break down the requirements

#### Step 1: Filter by creator

`WHERE creator_id = 100` restricts to the target creator.

#### Step 2: Deduplicate content types

`SELECT DISTINCT content_type` returns unique types only.

---

### The solution

**Filtered distinct values**

```sql
SELECT DISTINCT content_type
FROM content_items
WHERE creator_id = 100
```

> **Cost Analysis**
>
> Scan of 2M rows filtered to one creator's items. An index on `creator_id` would make this a fast seek. Output is a handful of content types.

> **Interviewers Watch For**
>
> Whether the candidate uses DISTINCT vs GROUP BY. Both produce the same result here; DISTINCT is semantically clearer for deduplication.

> **Common Pitfall**
>
> Using GROUP BY without understanding that it also deduplicates. Both work, but DISTINCT is the idiomatic choice when you only need unique values without aggregation.

---

## Common follow-up questions

- When would GROUP BY be preferred over DISTINCT? _(When you also need aggregates like COUNT or SUM alongside the distinct values.)_
- How would you show the count of items per type for this creator? _(Replace DISTINCT with GROUP BY and add COUNT(*).)_
- What if creator_id were text instead of integer? _(Tests type-safe comparison: WHERE creator_id = '100'.)_

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/content_types_by_creator)
- [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.