SUBSTRING() in MySQL — How It Works

What the MySQL SUBSTRING() function does, with an example.

Published October 18, 2026

SUBSTRING() extracts a portion of a string, starting at a given position for a given length.

Key points

  • Part of standard SQL functions available in MySQL for working with text/strings

Example

SELECT SUBSTRING('Hello World', 1, 5);  -- 'Hello'
More SQL articles