From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Adding and removing columns with SQL code

Adding and removing columns with SQL code - MySQL Tutorial

From the course: MySQL Database Administration

Adding and removing columns with SQL code

- [Instructor] All right, in this video we're going to be talking about using SQL code to alter tables. We can add, we can drop, and we can also place new constraints on columns. We'll always specify alter table and then the tablename And then we can either use add or drop with column names that we'd like to add or drop. When we add a column, we must also specify its data type and we have the option to add a column and specify where it should appear so that could either be something like first or it could be after. And when we use after, we would name another column that we want this new column to come after. If we don't specify where the column will be placed, it will just come into the end of the list of columns. Let's jump into Workbench and walk through some examples. All right, so here we've got our customer purchases data from our thriftshop Schema again, so still using the same Schema that we used in the previous lecture. And we've got a select star from customer_purchases just…

Contents