---
title: "How to Delete a Row: SQL Explained"
description: "You need to know these SQL query and rules to delete a row from a Table in DB2 database"
url: https://srinimf.com/2018/03/08/db2-sql-to-delete-a-row/
date: 2018-03-08
modified: 2022-12-30
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2018/03/pexels-photo-996329.jpeg?fit=1880%2C1253&ssl=1
categories: ["Categories", "Mainframe DB2"]
tags: ["DB2 Tips and Solutions", "DELETE SQL query best example"]
type: post
lang: en
---

# How to Delete a Row: SQL Explained

Here’s SQL query to delete specific row /or group of rows explained for your use in projects.

## What’s Delete statement

Here’re a few points to consider before **DELETE** a row from a Table.

- The delete removes data from your chosen table.
- You go to all that effort crafting designs, building physical models, and coding a variety of tools to create and manage your data. With one little statement you can remove the lot.
- Okay, It removes unwanted data from a table.

## SQL Query to delete a row

```
DELETE FROM employee
WHERE joindate <= '2010-01-01'
```

## Here’s how delete query works

- For those of you who’ve used other databases that are somewhat lax about the standard and syntactical correctness, the word from is not optional.
- As [with the other DML statements](http://amzn.to/2oVH7Rk), the where clause is optional. [By not specifying a where clause](https://srinimf.com/2017/01/23/tricky-db2-question-on-select-statement/), all rows from a table will be removed.
- Using a where clause limits the rows deleted to those that match the specified criteria. **Related** : [238 top SQL queries](https://srinimf.com/2014/01/20/238-top-sql-queries/)
- One interesting aspect of the DB2 delete and update implementation is that you’ll see a warning if the criteria you specify don’t match any rows; that is
- **if your delete statement won’t actually delete any rows. You’ll see this warning**:
- SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000.

**Resources**

- [IBM Knowledge center](https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/apsg/src/tpc/db2z_deletedatatables.html)

Related Posts

- [SQL Delete Top Examples Explained](https://srinimf.com/2010/05/16/db2-delete-in-sql/)DateMay 16, 2010
- [DB2 – DDL (Data Definition Language)](https://srinimf.com/2013/01/19/db2_ddl/)DateJanuary 19, 2013
- [DB2 SQL – Select, Insert, Delete and Update](https://srinimf.com/2015/02/16/simple-way-to-write-dml-sql-in-db2/)DateFebruary 16, 2015

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2018%2F03%2F08%2Fdb2-sql-to-delete-a-row%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2018%2F03%2Fpexels-photo-996329.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=How%20to%20Delete%20a%20Row%3A%20SQL%20Explained)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2018/03/08/db2-sql-to-delete-a-row/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2018/03/08/db2-sql-to-delete-a-row/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2018/03/08/db2-sql-to-delete-a-row/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2018/03/08/db2-sql-to-delete-a-row/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20Delete%20a%20Row%3A%20SQL%20Explained&body=https%3A%2F%2Fsrinimf.com%2F2018%2F03%2F08%2Fdb2-sql-to-delete-a-row%2F&share=email)
-

### Like this:

Like Loading…
