SQL DELETE Statement. The SQL DELETE Statement. The DELETE statement is used to delete existing records in a table. DELETE Syntax. DELETE FROM table_name. WHERE condition. Note: Be careful when deleting records in a table! Notice the WHERE clause in the. DELETE statement. The WHERE clause specifies which record(s) that should be deleted. If. you omit the WHERE clause, all records in the table will be deleted! Demo Database. Below is a selection from the "Customers" table in the Northwind sample. Customer. IDCustomer. · T-SQL Programming Part 8 - Removing Rows with the DELETE Statement in SQL Server.
Name. Contact. Name. Address. City. Postal. Code. Country. 1Alfreds Futterkiste. Maria Anders. Obere Str. Berlin. 12. 20. 9Germany. Ana Trujillo Emparedados y helados. Ana Trujillo. Avda. Constitución 2. 22. México D. F. 0. 50. Mexico. 3Antonio Moreno Taquería. Antonio Moreno. Mataderos 2. México D. F. 0. 50. Mexico. 4Around the Horn. Thomas Hardy. 12. Hanover Sq. London. WA1 1. DPUK5. Berglunds snabbköp. Christina Berglund. Berguvsvägen 8. LuleåS- 9. Sweden. SQL DELETE Example. The following SQL statement deletes the customer "Alfreds Futterkiste" from. Customers" table: Example. DELETE FROM Customers. WHERE Customer. Name='Alfreds Futterkiste'. Try it Yourself »The "Customers" table will now look like this: Customer. IDCustomer. Name. Contact. Name. Address. City. Postal. Code. Country. 2Ana Trujillo Emparedados y helados. Ana Trujillo. Avda. Constitución 2. 22. México D. F. 0. 50. Mexico. 3Antonio Moreno Taquería. Antonio Moreno. Mataderos 2. México D. F. 0. 50. Mexico. 4Around the Horn. Thomas Hardy. 12. Hanover Sq. London. WA1 1. DPUK5. Berglunds snabbköp. Christina Berglund. Berguvsvägen 8. LuleåS- 9. Sweden. Delete All Records. It is possible to delete all rows in a table without deleting the table. This. means that the table structure, attributes, and indexes will be intact. DELETE FROM table_name. DELETE * FROM table_name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |