Update

Update is changing data in the table.

UPDATE table_name SET column1 = value1, column2 = value2, ...
WHERE condition;

The where statement is optional. If no condition is specified with where, the change is made in all the rows of the table

UPDATE film SET title = ‘Zoo Lander Fiction’ WHERE film_id = 999;

Changed the value in the title column in the record with film_id = 999. If we didn’t specify where with the condition, all the values in the title column in the table would change with the ‘Zoo Lander Fiction’ value.

UPDATE film SET release_year = ‘İki bin On’ WHERE film_id = 99 ;

In the error message returned on the screen as a result of the query, it is reported that the specified type of the column and the type of the new value are not the same.

**The data type of columns should be taken into account when updating the data.

To make changes in multiple lines;

The query modifies rows with film_id values between 17 and 20.

UPDATE film SET language_id=1 WHERE (film_id=17 or film_id=20) ;

The query modifies rows with film_id of 17 or 20. (That is, changes are made in 2 rows.)

UPDATE film SET language_id=2 WHERE (film_id=17 and film_id=20) ;

The query is logically correct and works, but no rows are changed, so UPDATE 0 returns on the screen. Because there is no row with film_id value of both 17 and 20.

Example:

UPDATE film SET language_id=2 WHERE title LIKE '%lone%'
returning *;

UPDATE film SET language_id=2 WHERE title LIKE 'alone%' ;

The query executes, but there is no change in any row. For the query to work correctly, the following two commands should be used.

UPDATE film SET language_id=2 WHERE title LIKE 'Alone%' ;
UPDATE film SET language_id=2 WHERE title ILIKE 'alone%' ;
UPDATE film SET language_id=2 WHERE title ILIKE 'Alone%'