MySQL is not accepting FK null

0

Good night, I have a request table, which has a FK client_id, this client-id, may possibly be null, but when marking that fk can be null, myslq does not accept, it marks as in null and I define a default value . What can it be?

    ALTER TABLE tabela . teste DROP FOREIGN KEY fk_pedido_cliente1 ; ALTER TABLE teste . pedido CHANGE COLUMN id_cliente id_cliente INT (11) NULL; ALTER TABLE teste . pedido ADD CONSTRAINT fk_pedido_cliente1   FOREIGN KEY (% with%)   REFERENCES id_cliente . teste ( cliente )   ON DELETE NO ACTION   ON UPDATE NO ACTION;

    
asked by anonymous 25.11.2018 / 05:38

0 answers