Home » MariaDB Update

MariaDB Update Data

In MariaDB, UPDATE statement is used to modify the existing fields by changing values in a table.

Syntax:

Or

The UPDATE statement can be used with WHERE, ORDER BY and LIMIT clause.

Example:


UPDATE a Single Column

We have a table “Students”, having the following data:

Mariadb Update 1

Let’s change the student_name ‘Aryan’ where ‘student_name’ was “Ajeet”.

Mariadb Update 2

Query is executed successfully. Now check the updated data:

Output:

Mariadb Update 3

Example2:


UPDATE Multiple Columns

You can also update more than one columns using the UPDATE satatement in MariaDB database. In the following example, we update two columns “student_name” and “student_address” in the table “Students” where “student_name” was “Alecia”.

Mariadb Update 4

The columns are updated now. You can check and verify the result by using SELECT statement:

Output:

Mariadb Update 5

Next TopicMariaDB Delete

You may also like