Quote:
Originally posted by Mincer
Can you show us the 2 insert statements? you have been trying?
|
FOUND
---------------------------------------------
CREATE TABLE Employee(
Matricola CHAR(6) PRIMARY KEY,
Name CHAR(20) NOT NULL,
Surname CHAR(20) NOT NULL,
Dipart CHAR(15),
Salary NUMERIC(9) DEFAULT 0,
UNIQUE (Surname,Name)
)
INSERT INTO `employee`
(`Matricola`, `Name`, `Surname`, `Dipart`, `Salary`)
VALUES ('', 'Jhon', 'White', NULL, 600)
INSERT INTO `employee`
(`Matricola`, `Name`, `Surname`, `Dipart`, `Salary`)
VALUES ('', 'Luc', 'White', NULL, 5000)
[root@localhost:3306] ERROR 1062: Valore duplicato '' per la chiave 1
-----------------------
As Primary key , Field Matricola is not given any value the first time, that is gets NULL (allowed ??).
The second time it gets no value again, that is it gets again the NULL value.
As primary key, I wonder if NULL is a valid value.... just the first time..
Clearly, not been a int (the PK field is a char), it can't be autoincremented, but .....
shouldn't be a impossible to let a primary key get the NULL value ??
Giuliano