good morning classmates I have an issue, what happens is that I am doing a database for my project in MySQL but I have a problem, in the requested tables and arealogistica in this area I have a single worker or person in charge of this area and when arrive several orders would have to repeat the primary key of the logistics area (idAreaLogistica).
this is the areaLogistica table:
CREATE TABLE AreaLogistica(idAreaLogistica INT PRIMARY KEY NOT NULL,
identificacionEmpleado INT NOT NULL,
nombreEmpleado VARCHAR(60) NOT NULL,
correo VARCHAR(20),
telefono VARCHAR(20) NOT NULL,
cumpleaños DATE NOT NULL);
is the requested table:
CREATE TABLE Pedido(codigoPedido INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fechaPedido DATE NOT NULL,
descripcionPedido VARCHAR(300),
fk_idCliente VARCHAR(30) NOT NULL,
FOREIGN KEY (fk_idCliente) REFERENCES Cliente(idCliente));
these would be the data of the areaLogistica table
insert into arealogistica(idAreaLogistica, identificacionEmpleado, nombreEmpleado, correo, telefono, cumpleaños, fk_codigoPedido, fk_nit)
values(2,1037890755, 'Jeferson Andres Moreno', '[email protected]', '3105678456', '1998-06-09', 1, '900.017.253-6'),
(2,1037890755, 'Jeferson Andres Moreno', '[email protected]', '3105678456', '1998-06-09', 2, '900.017.253-6'),
(2,1037890755, 'Jeferson Andres Moreno', '[email protected]', '3105678456', '1998-06-09', 3, '900.017.253-6');
the relationship is many to many. logically I get the error that I can not repeat the primary key.
Thanks in advance and sorry but I'm just starting on the subject.