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, the where clause is optional. By not specifying a where clause, 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
- 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.