PostgreSQL SPLIT_PART() function
SPLIT_PART() function
The PostgreSQL split_part function is used to split a given string based on a delimiter and pick out the desired field from the string, start from the left of the string.
Syntax:
split_part(<string>,<delimiter>, <field_number>)
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL SPLIT_PART() function

Example: PostgreSQL SPLIT_PART() function :
In the example below, the delimiter of the defined string is '-#-' and specified field number is 2. So the split_part function splits the second field from the specified string.
SELECT split_part('ordno-#-orddt-#-ordamt', '-#-', 2);
Sample Output:
split_part ------------ orddt (1 row)
Previous: RTRIM function
Next: STRPOS function
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises