Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 17-11-2009
Member
 
Join Date: Jan 2009
Posts: 30
Diffetent ways to delete data from tables in SQL

Hi,

I am aware about how to insert, update the records of tables in SQL. But don't know how to delete the records from tables.

Is there any way to delete records on particular condition?
Can we delete all records in the table on single time?

Please provide me the possible queries with proper syntax.
Reply With Quote
  #2  
Old 17-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Diffetent ways to delete data from tables in SQL

Hi friend,

SQL is very flexible you can delete the data from table on particular condition or you can also delete all records at same time.

See following syntax:

Quote:
DELETE FROM Table_Name WHERE field_Name = 'Condition';
//here Table_Name is the name of table on which you want to perform operation.
e.g:

Quote:
DELETE FROM School WHERE stud_ID = '06';
Reply With Quote
  #3  
Old 17-11-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Diffetent ways to delete data from tables in SQL

It is possible in SQL to delete all the rows from a table using single query statement. All you will need to do is not specify any condition.
For this you will have to use the delete command of the SQL and provide the table name
Here is the query to delete all the rows from the table:

syntax:

delete from table_name;


example:

delete from emp2;
Reply With Quote
  #4  
Old 17-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Diffetent ways to delete data from tables in SQL

For your kind information you can use another select statement as a condition for the delete command.I have tried this type of queries and it's successful.

see below:

Quote:
DELETE FROM ACCNT
WHERE
emp_name=( SELECT emp_name FROM ACCNT where dept='IT');
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Diffetent ways to delete data from tables in SQL"
Thread Thread Starter Forum Replies Last Post
MySQL: Entering data in tables Botan Software Development 2 22-12-2010 05:44 AM
Access 2007: "cannot delete from specified tables" error T@abitha Software Development 4 30-11-2010 01:14 PM
Different ways for transferring data from one PC to another Ernesto4 Technology & Internet 5 06-01-2010 02:53 PM
Will reinstalling WIN XP delete my data ? Ihit Windows XP Support 4 25-01-2005 04:14 AM


All times are GMT +5.5. The time now is 02:06 AM.