Category Archives: Mysql

What are the differences between INSERT, UPDATE, REPLACE in MySql?

These are totally different statements. Insert: Insert new record. Example : INSERT INTO table(fields) VALUES(values); Update: Update existing record Example : UPDATE table SET fields=values Where conditions; Replace: This syntax is the same as the INSERT. The old row is deleted before the new row is inserted. Example : REPLACE INTO table SET fields=values;

Update all values of a column to Upper case

Update all values of a column to upper case Mysql UPPER function is used to update field in uppercase. UPDATE table_name SET fieldname = UPPER(fieldname) example : UPDATE member SET first_name = UPPER( first_name );

Update all values of a column to lowercase

Update all values of a column to lowercase Mysql LOWER function is used to update field in lowercase. UPDATE table_name SET fieldname = LOWER(fieldname) example : UPDATE member SET first_name = LOWER( first_name );

How to use GROUP_CONCAT in mysql

GROUP_CONCAT() function is used to concatenate column values into a single string. The following illustrates the GROUP_CONCAT function: SELECT GROUP_CONCAT(country SEPARATOR ‘;’) FROM customers ORDER BY country;