diff --git a/README.md b/README.md index d94b42c..ad4e015 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Create a new post: `hugo new --kind post posts/.md` - [x] WHERE - [x] INSERT - [x] UPDATE -- [ ] DELETE +- [x] DELETE - [ ] ORDER BY - [ ] GROUP BY - [ ] AND, OR, NOT diff --git a/content/posts/delete.md b/content/posts/delete.md new file mode 100644 index 0000000..de2fcd8 --- /dev/null +++ b/content/posts/delete.md @@ -0,0 +1,26 @@ +--- +title: "Delete" +date: 2024-01-01T20:40:45+03:30 +--- +With `DELETE` we can delete one or multiple rows from a table. + +{{< tabs tabTotal="1" >}} +{{< tab tabName="PostgreSQL" >}} +```sql +-- when you don't provide a where condition with your delete it will +-- delete all rows in your table +-- Don't run this query on your sample database, until you know what you're doing +DELETE FROM orders; + +-- delete all orders of a user with id of 10 +DELETE FROM + orders +WHERE + user_id = 12; +``` + +Read more about Delete on +[PostgreSQL docs](https://www.postgresql.org/docs/current/sql-delete.html) + +{{< /tab >}} +{{< /tabs >}}