C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQL DELETE StatementThe SQL DELETE statement is used to delete rows from a table. Generally, DELETE statement removes one or more records form a table. Syntax DELETE FROM table_name WHERE some_condition; Sample TableEMPLOYEE
Deleting Single RecordDelete the row from the table EMPLOYEE where EMP_NAME = 'Kristen'. This will delete only the fourth row. Query DELETE FROM EMPLOYEE WHERE EMP_NAME = 'Kristen'; Output: After executing this query, the EMPLOYEE table will look like:
Deleting Multiple RecordDelete the row from the EMPLOYEE table where AGE is 30. This will delete two rows(first and third row). Query DELETE FROM EMPLOYEE WHERE AGE= 30; Output: After executing this query, the EMPLOYEE table will look like:
Delete all of the recordsDelete all the row from the EMPLOYEE table. After this, no records left to display. The EMPLOYEE table will become empty. Syntax DELETE * FROM table_name; or DELETE FROM table_name; Query DELETE FROM EMPLOYEE; Output: After executing this query, the EMPLOYEE table will look like:
Note: Using the condition in the WHERE clause, we can delete single as well as multiple records. If you want to delete all the records from the table, then you don't need to use the WHERE clause.
Next TopicDBMS SQL View
|