Here’s DELETE SQL query, which deletes a specific row or the rows of matching criteria in WHERE clause.
DELETE SQL Query
- Below are some magic points you need to know before you DELETE a row from Table. Using Delete Statements always my favorite statement.
- 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'
Delete from tablename Where criteria are met
- 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.