As we all know, with the help of QUOTE() function, we can put the value of a column in single quotes. By using the QUOTE() function with the UPDATE clause, we can update a table with quoted values. We need to pass the column name as a parameter to the QUOTE() function. The following example will update the table "examination_btech" after placing the value of the "Course" column in single quotes.
mysql> UPDATE examination_btech SET Course = QUOTE(Course); Query OK, 10 rows affected (0.05 sec) mysql> Select * from examination_btech; +--------+----------+----------+ | RollNo | Name | Course | +--------+----------+----------+ | 1 | Rahul | 'B.Tech' | | 2 | Raman | 'B.Tech' | | 3 | Sahil | 'B.Tech' | | 4 | Shalini | 'B.Tech' | | 5 | Pankaj | 'B.Tech' | | 6 | Mohan | 'B.Tech' | | 7 | Yash | 'B.Tech' | | 8 | digvijay | 'B.Tech' | | 9 | Gurdas | 'B.Tech' | | 10 | Preeti | 'B.Tech' | +--------+----------+----------+ 10 rows in set (0.00 sec)
The above is the detailed content of How to update a MySQL table after quoting a column's value with single quotes?. For more information, please follow other related articles on the PHP Chinese website!