SUBSTRING_INDEX

Returns a substring from a string before or after a specified number of delimiter occurrences.

Analyze Syntax

func.substring_index(<str>, <delim>, <count>)

Analyze Examples

func.substring_index('www.example.com', '.', 2)

┌───────────────┐
 'www.example'  
└───────────────┘

SQL Syntax

SUBSTRING_INDEX(<str>, <delim>, <count>)

SQL Examples

SELECT SUBSTRING_INDEX('www.example.com', '.', 2);

┌─────────────┐
 www.example  
└─────────────┘