Procesadores
mysql> show create table usuario; +---------+---------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------+ | usuario | CREATE TABLE `usuario` ( `num_usuario` smallint(5) unsigned NOT NULL, `no_control` char(8) DEFAULT NULL, `nombre` char(40) DEFAULT NULL,`direccion` char(40) DEFAULT NULL, `ciudad` char(40) DEFAULT NULL, `telefono` char(20) DEFAULT NULL, `carrera` char(20) DEFAULT NULL, `correo` char(50) DEFAULT NULL, PRIMARY KEY (`num_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> notee mysql> alter table usuario add column sexo char(40)first; Query OK, 5 rows affected (0.31 sec) Records: 5 Duplicates: 0 Warnings: 0 DESPUES mysql> show create table usuario; +---------+---------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------+ | usuario | CREATE TABLE `usuario` ( `sexo` char(40) DEFAULT NULL, `num_usuario` smallint(5)unsigned NOT NULL, `no_control` char(8) DEFAULT NULL, `nombre` char(40) DEFAULT NULL, `direccion` char(40) DEFAULT NULL, `ciudad` char(40) DEFAULT NULL, `telefono` char(20) DEFAULT NULL, `carrera` char(20) DEFAULT NULL, `correo` char(50) DEFAULT NULL, PRIMARY KEY (`num_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------+ 1 row inset (0.00 sec) mysql> note
ALTER TABLE ADD COLUMN AFTER
ANTES mysql> show create table usuario; +---------+---------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------+ | usuario | CREATE TABLE `usuario` ( `sexo` char(40) DEFAULT NULL, `num_usuario` smallint(5) unsigned NOT NULL,`no_control` char(8) DEFAULT NULL, `nombre` char(40) DEFAULT NULL, `direccion` char(40) DEFAULT NULL, `ciudad` char(40) DEFAULT NULL, `telefono` char(20) DEFAULT NULL, `carrera` char(20) DEFAULT NULL, `correo` char(50) DEFAULT NULL, PRIMARY KEY (`num_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------+ 1 row in set (0.00 sec) mysql>alter table usuario add column sexo char(40) after direccion; Query OK, 5 rows affected (0.24 sec) Records: 5 Duplicates: 0 Warnings: 0 DESPUES mysql> show create table usuario; +---------+---------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------+ | usuario | CREATE TABLE `usuario` (`num_usuario` smallint(5) unsigned NOT NULL, `no_control` char(8) DEFAULT NULL, `nombre` char(40) DEFAULT NULL, `direccion` char(40) DEFAULT NULL, `sexo` char(40) DEFAULT NULL, `ciudad` char(40) DEFAULT NULL, `telefono` char(20) DEFAULT NULL, `carrera` char(20) DEFAULT NULL, `correo` char(50) DEFAULT NULL, PRIMARY KEY (`num_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |+---------+---------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> notee
ALTER TABLE ADD COLUMN
ANTES mysql> show create table usuario; +---------+---------------------------------------------------------------+ | Table | Create Table | +---------+---------------------------------------------------------------+ | usuario | CREATE TABLE `usuario` ( `num_usuario` smallint(5)unsigned NOT NULL, `no_control` char(8) DEFAULT NULL, `nombre` char(40) DEFAULT NULL, `direccion` char(40) DEFAULT NULL, `ciudad` char(40) DEFAULT NULL, `telefono` char(20) DEFAULT NULL, `carrera` char(20) DEFAULT NULL, `correo` char(50) DEFAULT NULL, PRIMARY KEY (`num_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------+ 1 row...
Regístrate para leer el documento completo.