How can you add a new column to an existing table?

To add a new column to an existing table, you can use the ALTER TABLE statement followed by the ADD COLUMN clause. Here’s the general syntax:

ALTER TABLE table_name ADD COLUMN column_name column_type;

Example

If you have a table named users and you want to add a new column called email of type TEXT, you would execute the following SQL command:

ALTER TABLE users ADD COLUMN email TEXT;

This command will add the email column to the users table. Make sure to replace table_name, column_name, and column_type with your actual table name, desired column name, and the appropriate data type.

0 Comments

no data
Be the first to share your comment!