ALTER TABLE statement adds a new column to a table. You can use this command when you want to add columns to a table. The statement below adds a new column
twitter_handle to the
ALTER TABLE celebs ADD COLUMN twitter_handle TEXT;
ALTER TABLE is a clause that lets you make the specified changes.
celebs is the name of the table that is being changed.
ADD COLUMN is a clause that lets you add a new column to a table:
twitter_handleis the name of the new column being added
TEXTis the data type for the new column
NULL is a special value in SQL that represents missing or unknown data. Here, the rows that existed before the column was added have
NULL (∅) values for
Add a new column to the table. In the code editor, type:
ALTER TABLE celebs ADD COLUMN twitter_handle TEXT; SELECT * FROM celebs;
Take this course for free