> For the complete documentation index, see [llms.txt](https://dshub.gitbook.io/ds-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dshub.gitbook.io/ds-hub/sql/sql-data-manipulation.md).

# SQL Data Manipulation

Data manipulation is a critical aspect of working with databases, and PostgreSQL offers a robust set of commands for managing and interacting with data. Among these, the `INSERT` statement is used to add new records to a table, while the `UPDATE` statement modifies existing data. The `DELETE` statement, on the other hand, is used to remove records from a table. You can check more on these statements/commands in the [Creating and Modifying Tables](/ds-hub/sql/sql-basics/creating-and-modifying-tables-views.md) section.

In conjunction with these commands, PostgreSQL also provides powerful functions for [string operation](/ds-hub/sql/sql-data-manipulation/string-operations.md)s, such as concatenation, trimming, and substring extraction, as well as a comprehensive suite of [date and time functions](/ds-hub/sql/sql-data-manipulation/date-time-operations.md) that assist in calculating intervals, extracting specific date parts, and formatting dates. Mastering these data manipulation techniques is essential for effective data analyses and a must for all who are working with data.

## 1. Dataset

In the following subsections, we will be using `film,` `customer` , `payment` and `rental` tables from the `dvdrental` database (formally known as [Sakila Database](https://github.com/jOOQ/sakila)) which  can be accessed via: <https://www.postgresqltutorial.com/postgresql-getting-started/postgresql-sample-database/>.

If you like to download the database and run the examples (which I highly recommend) in your local postgres server, you can follow the instructions [here](https://www.postgresqltutorial.com/postgresql-getting-started/load-postgresql-sample-database/).

## 2. [String Operations](/ds-hub/sql/sql-data-manipulation/string-operations.md)

## 3. [Date Operations](/ds-hub/sql/sql-data-manipulation/date-time-operations.md)

```sql
```
