AnalystPath

Asset Labels With a Three-Digit Code

SQLEasyJunior level~15 min

Problem

A warehouse keeps a free-text label on every asset. Some labels embed a short numeric code. Return every asset whose `asset_label` contains a run of **exactly three** consecutive digits. A run of two digits (like `42`) or four or more digits (like `5500`) does not count — only a group that is precisely three digits long, with a non-digit (or the start/end of the string) on each side. Return `asset_id` and `asset_label`, ordered by `asset_id` ascending.

Tables

Example rows — the live problem includes the full dataset.

warehouse_assets
asset_idasset_label
1Pallet RK402 north
2Forklift A12B7
3Crate batch 90817

Expected output

Your answer should return 3 rows with the columns asset_id, asset_label.

Starter code (SQL)

SELECT *
FROM warehouse_assets;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions