SQL DELETE

SQL DELETE Statement is used to delete one or more then one row removed from table.

SQL DELETE Query use following two way,

  • Remove all TABLE rows
  • Remove only specific TABLE row/rows

Remove only specific TABLE row

Syntax

DELETE FROM table_name 
    [ WHERE condition ]
    [ LIMIT number ];

Example

SQL> DELETE FROM demo1 WHERE NO = 10;

1 row deleted.

SQL> SELECT * FROM demo1;

 NO NAME              ADDRESS                        CONTACT_NO
--- ----------------- ------------------------------ -------------------
  1 Opal Kole         63 street Ct.                  000-444-8291
  2 Max Miller        41 NEW ROAD.                   000-444-8736
  3 Beccaa Moss       2500 green city.               000-444-8030
  4 Paul Singh        1343 Prospect St               000-444-8029
  5 Ken Myer          137 Clay Road                  000-444-7972
  6 Jack Evans        1365 Grove Way                 000-444-8845
  7 Reed Koch         1274 West Street               000-444-5672
  8 Gabe Hee          1220 Dallas Drive              000-444-5472
  9 Ben Mares         101 Candy Road                 000-444-6372

9 rows selected.

Remove all TABLE rows

Remove the all table row use this simple delete statement to delete all table data. after execute delete statement SELECT statement to check table is empty or not.

Syntax

DELETE FROM table_name;

Example

SQL> DELETE FROM demo1;

9 rows deleted.

SQL> SELECT * FROM demo1;

no rows selected.