SQL DELETE Statement

The SQL DELETE statement is used to delete records that already exist in a table. We can use the WHERE clause with the DELETE statement to delete the selected rows, otherwise all records will be deleted.

DELETE Statement Syntax :

The syntax of the DELETE statement is −

DELETE FROM table-name WHERE condition;

In this, records that satisfying the WHERE condition are to be deleted.



DELETE Statement Example :

Consider the Customer table with the following records -

CustomerID CustomerName Age Address CustomerSalary
1 Aarav 28 Udaipur 28000
2 Vivaan 25 Mumbai 30000
3 Reyansh 28 Chennai 35000
4 Muhammad 24 Udaipur 50000
5 Sai 30 Mumbai 27000


TEST CASE 1 :- The following code is an example, which would delete the record from Customer table where CustomerName='Sai'.

DELETE FROM Customer WHERE CustomerName='Sai';


The result for the respective sql query is as follows −

CustomerID CustomerName Age Address CustomerSalary
1 Aarav 28 Udaipur 28000
2 Vivaan 25 Mumbai 30000
3 Reyansh 28 Chennai 35000
4 Muhammad 24 Udaipur 50000



TEST CASE 2:- The following code is an example, which would delete all the records from Customer table.

DELETE FROM Customer;


The result for the respective sql query is as follows −
You have changed the database. All records have been deleted from the customer table.





Visit :


Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+628-628-1=0+0+0+1 --

pHqghUme
-1 OR 3+628-628-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+628-628) --

pHqghUme
-1 OR 3*2>(0+5+628-628) --

pHqghUme
-1 OR 2+377-377-1=0+0+0+1

pHqghUme
-1 OR 3+377-377-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+377-377)

pHqghUme
-1 OR 3*2>(0+5+377-377)

pHqghUme
-1' OR 2+485-485-1=0+0+0+1 --

pHqghUme
-1' OR 3+485-485-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+485-485) --

pHqghUme
-1' OR 3*2>(0+5+485-485) --

pHqghUme
-1' OR 2+266-266-1=0+0+0+1 or 'D15AVApV'='

pHqghUme
-1' OR 3+266-266-1=0+0+0+1 or 'D15AVApV'='

pHqghUme
-1' OR 3*2<(0+5+266-266) or 'D15AVApV'='

pHqghUme
-1' OR 3*2>(0+5+266-266) or 'D15AVApV'='

pHqghUme
-1" OR 2+398-398-1=0+0+0+1 --

pHqghUme
-1" OR 3+398-398-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+398-398) --

pHqghUme
-1" OR 3*2>(0+5+398-398) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
hWdMqvmO'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 85=(SELECT 85 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 870=(SELECT 870 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 194=(SELECT 194 FROM PG_SLEEP(15))--

pHqghUme
aDqvw05j' OR 730=(SELECT 730 FROM PG_SLEEP(15))--

pHqghUme
57aWW29A') OR 48=(SELECT 48 FROM PG_SLEEP(15))--

pHqghUme
TgpDpVPI')) OR 150=(SELECT 150 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@q19yr

pHqghUme
555

pHqghUme
555

pHqghUme
555