Maison > base de données > tutoriel mysql > MySQL在指定列之前或之后插入列 (Add a column to an existing M

MySQL在指定列之前或之后插入列 (Add a column to an existing M

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-06-07 15:34:08
original
1741 Les gens l'ont consulté

To add a column called email to the contacts table created in Create a basic MySQL table with a datatype of VARCHAR(80), use the following SQL statement: ALTER TABLE contacts ADD email VARCHAR(60); This first statement will add the email c


To add a column called email to the contacts table created in Create a basic MySQL table with a datatype of VARCHAR(80), use the following SQL statement:

ALTER TABLE contacts ADD email VARCHAR(60);
Copier après la connexion

This first statement will add the email column to the end of the table. To insert the new column after a specific column, such as name, use this statement:

ALTER TABLE contacts ADD email VARCHAR(60) AFTER name;
Copier après la connexion


If you want the new column to be first, use this statement:

ALTER TABLE contacts ADD email VARCHAR(60) FIRST;
Copier après la connexion


Étiquettes associées:
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers numéros
MySQL arrête le processus
Depuis 1970-01-01 08:00:00
0
0
0
Env中mysql
Depuis 1970-01-01 08:00:00
0
0
0
Erreur lors de l'installation de MySQL sous Linux
Depuis 1970-01-01 08:00:00
0
0
0
php - problème de surveillance MySQL
Depuis 1970-01-01 08:00:00
0
0
0
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal