Jump to content

Swapnil

Banned
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Swapnil

  • Rank
    Newbie
  1. Swapnil

    Delete query very slow

    - DELETE Statement with One Condition If you run a DELETE statement with no conditions in the WHERE clause, all of the records from the table will be deleted. As a result, you will most often include a WHERE clause with at least one condition in your DELETE statement. Let's start with a simple example of a DELETE query that has one condition in the WHERE clause. In this example, we have a table called suppliers with the following data: supplier_id supplier_name city state 100 Microsoft Redmond Washington 200 Google Mountain View California 300 Oracle Redwood City California 400 Kimberly-Clark Irving Texas 500 Tyson Foods Springdale Arkansas 600 SC Johnson Racine Wisconsin 700 Dole Food Company Westlake Village California 800 Flowers Foods Thomasville Georgia 900 Electronic Arts Redwood City California Enter the following DELETE statement: Try It DELETE FROM suppliers WHERE supplier_name = 'Microsoft'; There will be 1 record deleted. Select the data from the suppliers table again: SELECT * FROM suppliers; These are the results that you should see: supplier_id supplier_name city state 200 Google Mountain View California 300 Oracle Redwood City California 400 Kimberly-Clark Irving Texas 500 Tyson Foods Springdale Arkansas 600 SC Johnson Racine Wisconsin 700 Dole Food Company Westlake Village California 800 Flowers Foods Thomasville Georgia 900 Electronic Arts Redwood City California This example would delete all records from the suppliers table where the supplier_name is 'Microsoft'
×