What is the usage of the SQL INSTR function?

The SQL INSTR function is used to find the position of the first occurrence of a substring within a string.

The syntax of the function is as follows:
INSTR(string, substring, start, occurrence)

  1. “string is the string that needs to be searched.”
  2. A substring is a smaller string that is searched for within a larger string.
  3. The “start” parameter is optional and represents the starting point for the search, with a default value of 1.
  4. ‘occurrence’ is an optional parameter that indicates the position of the substring to return within the string, with the default value being 1.

The function returns the position of the first occurrence of a substring in a string, or 0 if the substring is not found.

bannerAds