TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

SQL DELETE

SQL delete query with sql, tutorial, examples, insert, update, delete, select, join, database, table, join

<< Back to SQL

SQL DELETE

The SQL DELETE statement is used to delete rows from a table. Generally DELETE statement removes one or more records from a table.

SQL DELETE Syntax

Let's see the Syntax for the SQL DELETE statement:

DELETE FROM table_name [WHERE condition];

Here table_name is the table which has to be deleted. The WHERE clause in SQL DELETE statement is optional here.


SQL DELETE Example

Let us take a table, named "EMPLOYEE" table.

IDEMP_NAMECITYSALARY
101Adarsh SinghObra20000
102Sanjay SinghMeerut21000
103Priyanka SharmaRaipur25000
104Esha SinghalDelhi26000

Example of delete with WHERE clause is given below:

DELETE FROM EMPLOYEE WHERE ID=101;

Resulting table after the query:

IDEMP_NAMECITYSALARY
102Sanjay SinghMeerut21000
103Priyanka SharmaRaipur25000
104Esha SinghalDelhi26000

Another example of delete statement is given below

DELETE FROM EMPLOYEE;

Resulting table after the query:

IDEMP_NAMECITYSALARY

It will delete all the records of EMPLOYEE table.

It will delete the all the records of EMPLOYEE table where ID is 101.

The WHERE clause in the SQL DELETE statement is optional and it identifies the rows in the column that gets deleted.

WHERE clause is used to prevent the deletion of all the rows in the table, If you don't use the WHERE clause you might loss all the rows.


Invalid DELETE Statement for ORACLE database

You cannot use * (asterisk) symbol to delete all the records.

DELETE * FROM EMPLOYEE;

Topics of SQL DELETE Statement

Next TopicSQL Delete Table




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf