Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Ayuda Con Campos Auto_increment (https://www.clubdelphi.com/foros/showthread.php?t=45223)

drakkon 26-06-2007 20:25:57

Ayuda Con Campos Auto_increment
 
Hola amigos.

Necesito de su ayuda. Estoy en un proyecto en el que he creado mi base de datos en MySQL, y ocupo en unas de mi tablas crear un campo donde se maneje como AUTO_INCREMENT:

Código SQL [-]
CREATE TABLE rentas1 (
clave_rentas   INT NOT NULL AUTO_INCREMENT,
fecha   date NOT NULL,
importe_total   double(4,2) NOT NULL,
PRIMARY KEY(clave_rentas));
 
CREATE TABLE rentas2 (
clave_renta         INT NOT NULL AUTO_INCREMENT,
codigo_pelic        varchar(15) NOT NULL,
id_cliente            varchar(15) NOT NULL,
fecha_devoluc     date NOT NULL,
precio                double(4,2) NOT NULL,
pagada              int(1) NULL DEFAULT '0',
cortesia             int(1) NULL DEFAULT '0',
PRIMARY KEY(clave_renta,codigo_pelic),
FOREIGN KEY(clave_renta) REFERENCES rentas1(clave_rentas) ON DELETE CASDADE, 
FOREIGN KEY(codigo_pelic) REFERENCES peliculas(codigo) ON DELETE CASDADE, 
FOREIGN KEY(id_cliente) REFERENCES clientes1(clave_cli) ON DELETE CASDADE);

... y lo que quisiera saber es, si es que las hay, cuales son las desventajas de manejar como AUTO_INCREMENT esos campos y que a la ves sean PRIMARY KEY`S. Espero me puedan ayudar.:rolleyes:


La franja horaria es GMT +2. Ahora son las 20:27:03.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi