How can I update MySQL table after quoting the values of a column with a single quote?

MySQLMySQLi Database

As we know that with the help of QUOTE() function we can put the values of a column in single quotes. By using QUOTE() function with UPDATE clause we can update the table having quoted values. We need to give column name as the parameter of QUOTE() function. Following example will update the table ‘examination_btech’ after putting the values of column ‘Course’ in single quotes.

Example

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)
raja
Published on 21-Feb-2018 16:04:31
Advertisements