Results 1 to 4 of 4

Thread: Diffetent ways to delete data from tables in SQL

  1. #1
    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.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    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:

    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:

    DELETE FROM School WHERE stud_ID = '06';

  3. #3
    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;

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    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:

    DELETE FROM ACCNT
    WHERE
    emp_name=( SELECT emp_name FROM ACCNT where dept='IT');

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,005,482.61069 seconds with 16 queries