May 2020
Beginner
564 pages
14h 9m
English
In a similar way to how you add columns, you can also drop columns. Let's say you changed your mind and don't want to track the number of atbats and hits of a player for each year that they were in college. To drop columns from an existing table, you need to execute the following scripts:
USE foraltering; ALTER TABLE tableforalteringDROP COLUMN atbats;ALTER TABLE tableforalteringDROP COLUMN hits;
If you want to drop both columns in the same query, you can execute the following query instead:
USE foraltering; ALTER TABLE tableforalteringDROP COLUMN atbats, DROP COLUMN hits;
The following screenshot shows the new columns are dropped from the table:
You cannot drop a column or columns that are part of a foreign key relationship; ...
Read now
Unlock full access