How to Add a Column in MySQL

Adding a column in MySQL involves using the ALTER TABLE command.

Here’s an example of adding a created_at datetime column to your users table:

ALTER TABLE users ADD created_at DATETIME;

Adding a string (varchar) column with a not null constraint:

ALTER TABLE users ADD bio VARCHAR(100) NOT NULL;

Adding a boolean column with a default value:

ALTER TABLE users ADD active BOOLEAN DEFAULT TRUE;

MySQL offers extensive documentation on supported datatypes in their documentation.