The Update Records in database is used to modify or change the value of records which match with a specified criteria. The update query is accompanied by where clause that specify the condition on column specified. The Syntax used for Update Records are given as:
update "name of table" set "column name"="new value" where column name=" "
The above Syntax in SQL is used to update the table
set column name : Specify the name of the column where you want to set a new value.
where : The where clause specify the condition on the basis of which set a new value into a table.
Understand with Example
The Tutorial illustrates an example from update record in database. In this Tutorial, the code run a select query to retrieve the records from a table country. The Table show you the record from table country. The Update query is used to specify the name of the column where you want to set a new value. In this database, we update a table country and set the new value to the column 'countrycapital' using where clause specify the condition on column specified upon the basis of which you a set a new value into a table.
Syntax used in Update Query
The select is used to retrieve the record from table country.
The Update statement is used to update the table country where you want to set a new value for a column and clause where specify the condition upon the basis on which you set a new record into the column table.
|select * from country;
update country set countrycapital='oslo'where countryname='norway';
Output of the above Query
Liked it! Share this Tutorial