Beginner

316. POSITION Function

Learn how to find the position of one string inside another string.

📘 Lesson 316 of 728 ⏱ 9 min 🎯 Intermediate

The POSITION function searches for a substring inside another string and returns its position when supported by the database.

Finding text positions helps analysts locate delimiters, prefixes, and specific parts of structured strings.

Find the position of the @ symbol in an email address.

SQL
SELECT
    Email,
    POSITION('@' IN Email) AS AtPosition
FROM Customers;

POSITION is useful for email analysis, text parsing, validation, and extracting structured information.

  • POSITION finds where text occurs.
  • It returns a character position.
  • It is useful for parsing strings.
  • It can support validation.
  • Syntax varies between database systems.
What does POSITION do?

POSITION returns the location of a substring within another string.

How can POSITION help analyze emails?

It can locate the @ symbol and help identify the boundary between an email username and domain.

Have you finished this lesson?

Introduction to SQL – All Lessons