• Home
  • SQL DELETE Statement

    The SQL DELETE statement is used to remove one or more records from a database table. It allows you to delete specific rows based on specified conditions.


    Here's the basic syntax of the DELETE statement:

    DELETE FROM table_name
    WHERE condition;

    In the above syntax:

    - `table_name` is the name of the table from which you want to delete records.
    - `WHERE` is a condition that specifies which rows should be deleted. If omitted, all rows in the table will be deleted.


    Here's an example to illustrate the usage of the DELETE statement:

    Let's say we have a table named "Customers" with columns "CustomerID," "FirstName," "LastName," and "City." We want to delete all customers who are from the city "New York." The query would be:

    DELETE FROM Customers
    WHERE City = 'New York';

    This query will delete all rows from the "Customers" table where the "City" column value is equal to "New York."


    Please exercise caution when using the DELETE statement, as it permanently removes data from the table. Make sure to double-check your conditions before executing a DELETE statement, as it can result in the loss of important data.



    About the Author



    Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

    We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





     PreviousNext