Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

SQL

Learn step by step



SQL - Delete query

Delete query is used to delete some or all data from a table, We can use where clause in delete query
Synatax

DELETE FROM table_name
WHERE [condition];

For example, say we have a table as below:

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Prakash tak Sivaji tak 34 delhi, rai nagar b-07,h-76 54886859
103 Ramesh jain Surajprakash jain 23 ajmer, suraj nagar b-258,h-746 1234568
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 26 mumbai, aajad nagar 1232584


Delete from TblStudent Where ID=103;

OutPut

After delete query , make select query on TblStudent.

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Prakash tak Sivaji tak 34 delhi, rai nagar b-07,h-76 54886859
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 45 mumbai, aajad nagar 1232584


Delete all record from TblStudent

Delete from TblStudent

OutPut

After delete query , make select query on TblStudent.

ID First_Name Last_Name Father_Name Age Address ContactNo

Now, TblStudent table would not have any record.



Related Videos