Home > Database > Mysql Tutorial > 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
Release: 2023-08-26 16:13:08
forward
1292 people have browsed it

如何在用单引号引用列的值后更新 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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template