How do I create my table to avoid java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '' for key 'PRIMARY'
Posted by: Karen Goh
Date: December 28, 2018 07:11AM

I would like to know how should I create my table such that the below error will not occur ;

java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '' for key 'PRIMARY'

Currently, I have

CREATE TABLE tutor_subject(

tutor_id INT NOT NULL,
subjectName Varchar(50) NOT NULL,

PRIMARY KEY (tutor_id))Engine=InnoDB Default charset=utf8mb4

Is it alright not to have Primary Key at all?

Options: ReplyQuote




Sorry, only registered users may post in this forum.

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.