Expand description

String expressions

Functions

  • Returns the numeric code of the first character of the argument. ascii(‘x’) = 120
  • Removes the longest string containing only characters in characters (a space by default) from the start and end of string. btrim(‘xyxtrimyyx’, ‘xyz’) = ‘trim’
  • Returns the character with the given code. chr(0) is disallowed because text data types cannot store that character. chr(65) = ‘A’
  • Concatenates the text representations of all the arguments. NULL arguments are ignored. concat(‘abcde’, 2, NULL, 22) = ‘abcde222’
  • Concatenates all but the first argument, with separators. The first argument is used as the separator string, and should not be NULL. Other NULL arguments are ignored. concat_ws(‘,’, ‘abcde’, 2, NULL, 22) = ‘abcde,2,22’
  • Converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters. initcap(‘hi THOMAS’) = ‘Hi Thomas’
  • Converts the string to all lower case. lower(‘TOM’) = ‘tom’
  • Removes the longest string containing only characters in characters (a space by default) from the start of string. ltrim(‘zzzytest’, ‘xyz’) = ‘test’
  • Repeats string the specified number of times. repeat(‘Pg’, 4) = ‘PgPgPgPg’
  • Replaces all occurrences in string of substring from with substring to. replace(‘abcdefabcdef’, ‘cd’, ‘XX’) = ‘abXXefabXXef’
  • Removes the longest string containing only characters in characters (a space by default) from the end of string. rtrim(‘testxxzx’, ‘xyz’) = ‘test’
  • Splits string at occurrences of delimiter and returns the n’th field (counting from one). split_part(‘abc~@def@ghi’, ‘@~’, 2) = ‘def’
  • Returns true if string starts with prefix. starts_with(‘alphabet’, ‘alph’) = ‘t’
  • Converts the number to its equivalent hexadecimal representation. to_hex(2147483647) = ‘7fffffff’
  • Converts the string to all upper case. upper(‘tom’) = ‘TOM’
  • Prints random (v4) uuid values per row uuid() = ‘a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11’