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 section.

In conjunction with these commands, PostgreSQL also provides powerful functions for string operations, such as concatenation, trimming, and substring extraction, as well as a comprehensive suite of date and time functions 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) 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.

Last updated