Collections:
FIND_IN_SET() - Find Substring in List String
How to find a substring in a given list string using the FIND_IN_SET() function?
✍: FYIcenter.com
FIND_IN_SET(str, strlist) is a MySQL built-in function that
searches for a substring in a given list string of comma separated substrings.
For example:
SET @obj = 'Apple'; SELECT FIND_IN_SET(@obj, 'Orange,Banana,Apple'); -- +------------------------------------------+ -- | FIND_IN_SET(@obj, 'Orange,Banana,Apple') | -- +------------------------------------------+ -- | 3 | -- +------------------------------------------+
Reference information of the FIND_IN_SET() function:
FIND_IN_SET(str, strlist) : idx Returns a value in the range of 1 to N if the string str is in the string list strlist consisting of N substrings. A string list is a string composed of substrings separated by , characters. If the first argument is a constant string and the second is a column of type SET, the FIND_IN_SET() function is optimized to use bit arithmetic. Returns 0 if str is not in strlist or if strlist is the empty string. Returns NULL if either argument is NULL. This function does not work properly if the first argument contains a comma (,) character. Arguments, return value and availability: str: Required. The substring to search for in the list string. strlist: Required. The list string of comma separated substrings. idx: Return value. The index of the substring in the list string. Available since MySQL 4.0.
⇒ FROM_BASE64() - Base64 Decoding
⇐ FIELD() - Find String in String List
2023-11-12, 1276🔥, 0💬
Popular Posts:
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Convert a Unicode Strings to Non-Unicode Strings in SQL Server Transact-SQL? Since Unicode ch...