Procesadores

Solo disponible en BuenasTareas
  • Páginas : 10 (2314 palabras )
  • Descarga(s) : 0
  • Publicado : 29 de agosto de 2012
Leer documento completo
Vista previa del texto
ALTER TABLE ADD COLUMN FIRST  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 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...
tracking img