Instruction
Well done! And what happens if we try to modify a table that has dependent views? If the modification doesn't affect the views, we'll be able to perform the operation. For instance, we have the following table and view:
CREATE TABLE gym ( id integer PRIMARY KEY, name varchar(32), city varchar(32), monthly_fee decimal(5, 2), max_capacity integer );
CREATE VIEW big_gyms_london AS SELECT id, name, max_capacity FROM gym WHERE city = 'London' AND max_capacity > 50;
We want to get rid of the monthly_fee column, so we can write:
ALTER TABLE gym DROP COLUMN monthly_fee;
Because the view doesn't use monthly_fee, we're able to delete the column just fine.
Exercise
Run the template code and see for yourself if you can modify a column that's not used by any view.



