From the course: Database Foundations: Intro to Databases

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Alter tables

Alter tables

From the course: Database Foundations: Intro to Databases

Start my 1-month free trial

Alter tables

- [Instructor] It's not uncommon to set up a data table and then later realize that you would like to add an additional column to that table. When you want to make a change to an object that you've already created, you're going to use the ALTER command. We can see how this works by creating another table. And then when we created the product table inside of our two trees database, we added a column for the category ID. The intent is to store an integer value here and then link that value to another table that'll give us the full description of the category. So let's create that second table now. I'm going to right click on the two trees database and choose new query. Then we'll create a new table in the product schema called categories. I'll open up my parentheses and the first column that I want to add will be called category ID. It'll be an integer value and it will be the primary key for the table. Then we'll add a…

Contents