I've created student table with student id , first name and last name .I've alos create trigger to generate student id

however when I want to inserte data to the student table I get this error
"not enough values "
here is my inserte statment
INSERT

INSERT INTO STUDENT (SID,FIRSTNAME,LASTNAME)
VALUES ('Joe','Ken);

Recommended Answers

All 3 Replies

your asking for 3 values:
SID,FIRSTNAME,LASTNAME

and only passing 2 back to it 'Joe','Ken'

assuming sid is an auto_incrimenting field just leave it out from the insert statement

INSERT INTO STUDENT (FIRSTNAME,LASTNAME) VALUES ('Joe','Ken');

your asking for 3 values:
SID,FIRSTNAME,LASTNAME

and only passing 2 back to it 'Joe','Ken'

assuming sid is an auto_incrimenting field just leave it out from the insert statement

INSERT INTO STUDENT (FIRSTNAME,LASTNAME) VALUES ('Joe','Ken');

I tried what u said , but I still get "not enough values " .. do u think the trigger not working

It should be ok if SID is auto_increment or is default value for SID, but ERROR if not

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.