MySQL Forums
Forum List  »  Docs

I need help for Error :1062
Posted by: Sebastiano Bellu
Date: April 28, 2005 09:22AM

Hi,

I don't undertand why I recived an error in MySQL Server 5.0 beta version:
ERROR 1062: Duplicate entry 'bellu' for key 1.

You can find below the script to create the table and to populate the table.
After this, if you run the simple "SELECT" query at the end,
is generated the error 1062.

SCRIPT:
------------------------------------------------------------------
CREATE TABLE `tbl_seba` (
`id` tinyint(4) NOT NULL default '0',
`cognome` varchar(50) NOT NULL default '',
`nome` varchar(50) NOT NULL default '',
`indirizzo` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
);

INSERT INTO tbl_seba
VALUES(1,'bellu','sebastiano','de gasperi');

INSERT INTO tbl_seba
VALUES(2,'bellu','alessio','da maiano');

INSERT INTO tbl_seba
VALUES(3,'mannu','rina','iglesias');

INSERT INTO tbl_seba
VALUES(4,'mannu','bastianina','iglesias');

INSERT INTO tbl_seba
VALUES(5,'depalmas','elena','de gasperi');

INSERT INTO tbl_seba
VALUES(6,'mannu','maria antonietta','iglesias');

INSERT INTO tbl_seba
VALUES(7,'fancello','maddalena','iglesias');

INSERT INTO tbl_seba
VALUES(8,'bellu','giuseppe','de gasperi');

commit;

select * from tbl_seba

SELECT cognome, count(1)
FROM tbl_seba
#where seba.cognome in ('bellu','mannu')
where cognome = 'bellu' or cognome = 'mannu'
group by 1
------------------------------------------------------------------

Thanks.
All the best.

Options: ReplyQuote


Subject
Views
Written By
Posted
I need help for Error :1062
12044
April 28, 2005 09:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.