UPDATEexamination_btechSETCourse=QUOTE(Course);QueryOK,10rowsaffected(0.05sec)mysql>Select*from"/> UPDATEexamination_btechSETCourse=QUOTE(Course);QueryOK,10rowsaffected(0.05sec)mysql>Select*from">

Home  >  Article  >  Database  >  How to update a MySQL table after quoting a column's value with single quotes?

How to update a MySQL table after quoting a column's value with single quotes?

WBOY
WBOYforward
2023-08-26 16:13:081265browse

如何在用单引号引用列的值后更新 MySQL 表?

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.

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)

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:Delimiter in MySQL?Next article:Delimiter in MySQL?