SPLIT_PART() is a string manipulation function used in SQL to split a string into multiple parts based on a delimiter and return a specific part. \n\nThe function takes three arguments:\n1. The input string: This is the string that needs to be split.\n2. The delimiter: This is the character or substring used to split the input string.\n3. The index: This is the position of the part that needs to be returned. The index starts from 1.\n\nThe function returns the specified part of the split string. If the index is out of range or the input string is empty, the function returns an empty string.\n\nExample usage:\n\n\nSELECT SPLIT_PART('John,Doe,30', ',', 2);\n\n\nIn this example, the input string is 'John,Doe,30', the delimiter is ',', and the index is 2. The function will split the input string into three parts: 'John', 'Doe', and '30'. It will then return the second part, which is 'Doe'.

SPLIT_PART() Function in SQL: Splitting Strings with Delimiters

原文地址: http://www.cveoy.top/t/topic/p2YH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录