quick links

MySQL string/Scalar functions

CONCAT, TRIM, UPPER, LOWER, SUBSTRING, INSTR, LENGTH are string functions

CONCAT

  • SQL concat function is used to append columns or append string to a columns.
  • SELECT concat(employee_name , '_' , age) from employee;

TRIM

  • Trim keyword is used to remove a space from a column.
  • SELECT trim(employee_name) from employee;

UPPER

  • MySQL UCASE() or UPPER() converts all the characters in a string to uppercase characters.
  • SELECT UPPER(CustomerName) AS UppercaseCustomerName FROM Customers;

LOWER

  • MySQL LCASE() or LOWER() converts the characters of a string to lower case characters.
  • SELECT LOWER(CustomerName) AS LowercaseCustomerName FROM Customers;

SUBSTRING

  • Extract a substring from a string (start at position 5, extract 3 characters).
  • SELECT SUBSTR("SQL Tutorial", 5, 3) AS ExtractString;

INSTR

  • Returns the position of the first occurrence of a string in another string
  • SELECT INSTR("W3Schools.com", "COM") AS MatchPosition;

LENGTH

  • Returns the length of the specified string
  • SELECT LENGTH("SQL Tutorial") AS LengthOfString;
 

About Us

Joomla Web Solution

We love working with PHP, HTML5, CSS3, jQuery and the most-loved content management framework in the world, Joomla!

LIKE US ON FACEBOOK