Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/01/2010, 14:07
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: Modififcar Primary Key Cmopuesta en MYSQL

Con alter table puedes hacer todo esto.

ejemplo:
Código MySQL:
Ver original
  1. mysql> create table compuesta(id integer,cedula integer);
  2. Query OK, 0 rows affected (0.11 sec)
  3.  
  4. mysql> alter table compuesta add primary key (id,cedula);
  5. Query OK, 0 rows affected (0.08 sec)
  6. Records: 0  Duplicates: 0  Warnings: 0
  7.  
  8. mysql> alter table compuesta drop primary key;
  9. Query OK, 0 rows affected (0.03 sec)
  10. Records: 0  Duplicates: 0  Warnings: 0
  11.  
  12. mysql> alter table compuesta add column serie integer;
  13. Query OK, 0 rows affected (0.02 sec)
  14. Records: 0  Duplicates: 0  Warnings: 0
  15.  
  16. mysql> alter table compuesta add primary key (id,cedula,serie);
  17. Query OK, 0 rows affected (0.01 sec)
  18. Records: 0  Duplicates: 0  Warnings: 0
  19.  
  20. mysql>

saludos
__________________
Without data, You are another person with an opinion.
W. Edwads Deming