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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Creating a schema using the MySQL Workbench UI2m 54s
-
(Locked)
Creating a schema using SQL code4m 27s
-
(Locked)
Creating a table using the MySQL Workbench UI6m 52s
-
(Locked)
Creating a table using SQL code6m 3s
-
(Locked)
MySQL data types5m 40s
-
(Locked)
Challenge: Creating your own schema and tables2m 28s
-
(Locked)
Solution: Creating your own schema and tables12m 1s
-
(Locked)
Adding and removing columns using the MySQL Workbench UI13m 39s
-
(Locked)
Adding and removing columns with SQL code5m 4s
-
(Locked)
Challenge: Adding and removing columns1m 25s
-
(Locked)
Solution: Adding and removing columns6m 59s
-
(Locked)
Dropping schemas and tables6m 45s
-
(Locked)
Challenge: Dropping schemas and tables1m 46s
-
(Locked)
Solution: Dropping schemas and tables2m 22s
-
(Locked)
-
-
-
-
-
-