Definition : 
  • This statement is used to remove one or more records permanently from the database table.
Syntax : 
  • DELETE table-name;
  • DELETE table-name where condition;
Example : 
Problem : How to remove all data/records from a table permanently.

SQL> Delete from employee;

SQL> Delete * from employee;

Problem : How to remove Single individual unique data/record from a table permanently.

SQL> Delete from employee where emp_id="105M";

Problem : How to remove multiple data/records from a table permanently in a given range.

(i) SQL> Delete from employee where Slno BETWEEN 1 AND 5;

(ii) SQL> Delete from employee where Slno BETWEEN >10 AND <50;

(iii) SQL> Delete from employee where Slno BETWEEN >=10 AND <=50;

(iv) SQL> Delete from employee where Slno BETWEEN 1 AND 5 AND Utype="student";

(iv) SQL> Delete from employee where Slno BETWEEN 1 AND 5 AND Utype="student" OR Utype="Teacher";

Problem : How to remove limited (here only 3)data/records from a table permanently from multiple(>3) retrieved similar data.

SQL> Delete from employee where empname="Robert" LIMIT 3;

Loading

Categories: SQL

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.