How do you add a field in mysql?

To add a field in a MySQL database, you can use the ALTER TABLE statement. Here is an example:

ALTER TABLE table_name
ADD column_name data_type;

For example, if you want to add a field named email to a table named users, you can use the following statement:

ALTER TABLE users
ADD email VARCHAR(50);

This will add a VARCHAR type field named email to the users table, with a maximum length of 50 characters. You can also specify additional data types and constraints as needed.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds