SQL string function REPLACE()

SQL string function REPLACE() Syntax: REPLACE(column_name, Find, Replace) Description: Used to replace an occurence of string/character in column data Parameters: Column_name – specifies the column to be manipulated Find – string to be matched Replace – string to replace the matched string Example: SELECT name, REPLACE (name, ‘m’, ‘M’) FROM product;
Continue reading…

Enjoyed this post? Share it!

 
 

SQL string function SUBSTRING()

SQL string function SUBSTRING() Syntax: SUBSTRING(column_name, Start, Length). Description: Find the SUBSTRING from column data Parameters: Column_name – specifies the column to be manipulated Start – Offset on the column Length – Number of characters to be extracted Example: SELECT SUBSTRING(name,3,5) FROM product;
Continue reading…

Enjoyed this post? Share it!

 
 

MySQL String Functions

BINARY string1=BINARY(string2) Returns the binary representation of a string. This function can be used to force case-sensitive comparisons when they would otherwise not occur. BIT_LENGTH bits=BIT_LENGTH(string) Returns the number of bits in a string. CHAR_LENGTH length=CHAR_LENGTH(string) Returns the number of characters in a string. Like LENGTH, except that it returns the number of characters, rather […]
Continue reading…

Enjoyed this post? Share it!

 
 

MySQL ASCII Function

The ASCII function in MySQL returns the ASCII character code corresponding to the first character in the provided input string. Example for using the ASCII function CREATE FUNCTION ascii_string (in_string VARCHAR(80) ) RETURNS VARCHAR(256) DETERMINISTIC BEGIN DECLARE i INT DEFAULT 1; DECLARE string_len INT; DECLARE out_string VARCHAR(256) DEFAULT ”;   SET string_len=LENGTH(in_string); WHILE (i<string_len) DO […]
Continue reading…

Enjoyed this post? Share it!