DROP COLUMN
The DROP COLUMN
command is used to delete a column in an existing table.
The following SQL deletes the “ContactName” column from the “Customers” table:
Example
ALTER TABLE Customers
DROP COLUMN ContactName;
The DROP COLUMN
command is used to delete a column in an existing table.
The following SQL deletes the “ContactName” column from the “Customers” table:
ALTER TABLE Customers
DROP COLUMN ContactName;
The DELETE
command is used to delete existing records in a table.
The following SQL statement deletes the customer “Alfreds Futterkiste” from the “Customers” table:
DELETE FROM Customers WHERE CustomerName=‘Alfreds Futterkiste’;
Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement. The WHERE clause specifies which record(s) should be deleted. If you omit the WHERE clause, all records in the table will be deleted!
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:
The following SQL statement deletes all rows in the “Customers” table, without deleting the table. This means that the table structure, attributes, and indexes will be intact: Continue reading SQL DELETE Keyword