# Successful Deploy Endpoint Calls

> Successful deploys only. No failures allowed.

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

Domain: SQL · Difficulty: easy · Seniority: L3

## Problem

How many successful API calls hit the '/deploy' endpoint? Success means a 200 status.

## Worked solution and explanation

### Why this problem exists in real interviews

This tests whether a candidate can demonstrate writing clean, correct queries under time pressure. This is a foundational check that interviewers use early in a round to verify baseline proficiency.

---

### Break down the requirements

#### Step 1: Select the target columns

The SELECT clause picks exactly the columns the prompt asks for. Returning extra columns or missing a required alias would fail the grading check.

#### Step 2: Verify the output shape

Confirm the result has the expected columns, ordering, and no duplicate rows. A quick sanity check on row count catches logic errors before submission.

---

### The solution

**Count api_calls matching endpoint and status predicates**

```sql
SELECT COUNT(*) AS success_count
FROM api_calls
WHERE status = 200 AND endpoint = '/deploy'
```

> **Cost Analysis**
>
> With ~100M rows, the query performs a single sequential scan. An index on the filter/join columns would reduce the scan to a seek.

> **Interviewers Watch For**
>
> Interviewers watch for whether the query returns exactly the columns and ordering the prompt specifies; how quickly you identify the core operation and write clean, minimal code.

> **Common Pitfall**
>
> Returning extra columns that the prompt did not ask for, or using the wrong column alias, causes a grading mismatch even when the logic is correct.

---

## Common follow-up questions

- If status is stored as TEXT ('200') rather than INTEGER, what subtle bug could arise in your equality check? _(Tests type-awareness; comparing integer literal 200 to text may silently cast or fail depending on the engine.)_
- Would COUNT(*) and COUNT(call_id) produce different results here, and when would they diverge? _(Tests understanding of COUNT behavior with NULLs vs. row presence.)_
- How would you extend this to also show the average latency of those successful deploy calls in the same query? _(Tests ability to add an aggregate without restructuring the query.)_

## Related

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