Thursday , April 25 2024

PostgreSQL Delete

In today’s article, we will talk about the use of the ‘Delete’ command to delete one or more data in a Table.

DELETE helps you to delete all the data in the table or the affected records according to the condition you specify.

Its general usage is as follows.

If the DELETE clause is executed without adding the where condition, all the data in the table is DELETED.

Since we will work in the ogrenci_d1 table, let’s look at the data in the table.

Let’s delete all the data specified in the ogrenci_d1 table with DELETE.

What should I do if I want to delete the student whose name is Faruk? We will use the where condition right here, let’s make our example of the where condition.

As seen above, our record named Faruk is not visible.

We can use the RETURNING command to see the deleted data, let’s delete one more data, but let’s see the deleted data by using the RETURNING command.

As seen in the picture above, we deleted our data and let’s look at the output of the deleted data by selecting our table.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories