MariaDB is an open-source Database Management System and its predecessor to MySQL. The pymysql client can be used to interact with MariaDB similar to that of MySQL using Python.
In this article, we will look into the process of using the UPDATE query on a table of the database using pymysql. The update is used to change the existing values in a database. By using the update statement a specific value can be corrected or updated. It only affects the data and not the structure of the table. The basic advantage provided by this command is that it keeps the table accurate.
UPDATE tablename SET column_nmae = "new value" WHERE conditions;
The following programs will help you understand this better.
Example 1 :
In the above program, We update Broad Band price from 1200 to 1400.
Example 2 :
In the above program, We update PRODUCT_ID to A123 WHERE price = 14782 AND PRODUCT_TYPE = ‘Voice’.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.