课程: Hands-On Introduction: SQL

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Change table structure

Change table structure

- Let's learn how to change the table structure by adding or modifying columns, renaming them, defining a default value for the new column, dropping columns from a table. We can do this by using the ALTER statement. ALTER statement is a DDL statement like "create" so it auto commits. This is the syntax for ALTER statement to add new columns. If you think that there is a need for a new column at a later point of time then we can use this ALTER statement to do so. Let's try to add a new column to "states" table. Let's go to chapter two, video two. Here, ALTER TABLE states, that's the table name, ADD COLUMN, this is the new column that I want to add, and the data type for it. Before running this I would like to show you how it looks like in the database first. Let's go to "states" table. And if you take a look at the columns, we do not have test column present. So now let's try to add this new column there. So we…

内容