SQL String Functions Practice — 14 Challenges (13 Free)

Text arrives messy: a full name in one column, a code with the meaning buried in characters 4 to 6, a category that is sometimes "Retail" and sometimes " retail ". These 14 challenges are the three moves that fix it — pull a piece out, rewrite the value, match a shape — on real tables in your browser. Thirteen are free.

Pulling a piece out — SUBSTR, INSTR and LENGTH: 8 challenges (7 free)

SUBSTR(col, 4, 3) takes three characters starting at the fourth; INSTR(col, '@') finds where a character sits so you can cut there instead of guessing an offset. Together they are how a domain comes out of an email, a year out of a text date, or a branch code out of an account number. LENGTH is the one that tells you the cut worked.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Easy Free

Long-Named Passengers

Uses: String Functions LENGTH WHERE

Try it →
Easy Free

Extract Family Names (SUBSTR + INSTR)

Uses: SUBSTR INSTR String Functions

Try it →
Easy Free

Year Code from Order Date (SUBSTR)

Uses: SUBSTR String Functions

Try it →
Easy Free

Movie Title Initial Letter Histogram (SUBSTR)

Uses: GROUP BY SUBSTR String Functions

Try it →
Easy Free

Position of '@' in Email (INSTR)

Uses: INSTR String Functions

Try it →
Medium Free

Email Provider Customer Analysis

Uses: String Functions GROUP BY Aggregation

Try it →
Medium Free

Email Username Extract (SUBSTR + INSTR)

Uses: SUBSTR INSTR String Functions

Try it →
Hard Pro

Passenger Family Survival Analysis

Uses: String Functions GROUP BY HAVING

Try it →

Rewriting the value — TRIM, REPLACE, UPPER and concatenation: 4 challenges (4 free)

The same category written three ways groups into three rows, and it is almost always whitespace or case. TRIM and UPPER collapse that before the GROUP BY sees it. || goes the other way and joins columns into one label, and GROUP_CONCAT folds a whole group into a single readable cell — the roster in one row rather than twelve.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Easy Free

Employee Display Cards (Concat)

Uses: String Functions Concatenation

Try it →
Easy Free

Country Codes in Uppercase

Uses: String Functions UPPER

Try it →
Easy Free

Movie Title Initial Letter Histogram (SUBSTR)

Uses: GROUP BY SUBSTR String Functions

Try it →
Medium Free

Department Roster with GROUP_CONCAT

Uses: GROUP BY GROUP_CONCAT Aggregation

Try it →

Matching a shape — LIKE and its two wildcards: 3 challenges (3 free)

LIKE 'A%' anchors at the start, '%bank%' matches anywhere, and _ stands for exactly one character. The judgement is the anchor: a leading % means the database cannot use an index and has to read everything, which is fine on the tables here and matters on a real one.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Medium Free

Title Social Survival Analysis

Uses: GROUP BY Aggregation HAVING

Try it →
Medium Free

Trust and Savings Banks

Uses: WHERE LIKE CASE

Try it →
Medium Free

LLC vs Individual Buyers

Uses: CASE GROUP BY Aggregation

Try it →

Where this shows up next

String work is rarely the answer on its own — it is the step that makes the real question askable. Cleaning a category is what makes an aggregation group correctly; splitting a key is what lets a join find its match; and a text date has to become a real one before date functions can touch it. When the cleaning takes more than one step, name the steps with a CTE.