SQL REVERSE function is used to return reverse of a string. It’s supported by MS SQL Server, MySQL. Oracle supports it too, but maybe not in the documents.
String Function
SQL LEFT Function
SQL LEFT() function is used to get left part of a string with the length of specified number. It is supported by MySQL, MS SQL Server, Access, but not by Oracle.
SQL TRIM
The SQL TRIM() function is used to remove the leading or trailing spaces of a string. Different databases have different writtings:
SQL Server | LTRIM(), RTRIM() |
Oracle | LTRIM(), RTRIM() |
MySQL | TRIM(), LTRIM(), RTRIM() |
In SQL Server or Oracle it doesn’t have Trim() function, we can combine LTrim() and RTrim():
RTRIM(LTRIM(str))
SQL MID
The SQL MID() function is used to get part of a string. It’s supported by MySQL, but not by MS SQL Server or Oracle. In SQL Server, Oracle databse, we can use SQL SUBSTRING or SQL SUBSTR instead.
SQL LENGTH, SQL LEN
SQL LENGTH or SQL LEN Function is used to get the length of a string. Different databases have different writtings:
SQL Server | LEN |
Oracle | LENGTH |
MySQL | LENGTH |
SQL Replace
The SQL Replace function is used to replace every occurrences of a specified string with a replacement string.
SQL CONCAT, Concatenate Function
SQL CONCAT Function is used to Concatenate (combine) 2 or more strings. Different databases have different writtings:
SQL Server | + |
Oracle | CONCAT(), || |
MySQL | CONCAT() |
SQL SUBSTRING
SQL SUBSTRING function is used to get part of a string. Different databases have different writtings:
SQL Server | SUBSTRING() |
Oracle | SUBSTR() |
MySQL | SUBSTR(), SUBSTRING() |