Search code examples
javadatabasederby

About "INSERT INTO... VALUES", Error message : VALUES clause must contain at least one element


I'm trying to set up a small attendance database for a project. One of the tables has three columns, 2 INTs and 1 SMALLINT. What I'm trying to do is insert these values into the table but I'm running into an error (provided under the code) I think I should note that I'm using NetBean's Derby Here's the code I'm using

INSERT INTO STUDENT_PRESENCE(STUDENT_ID, CLASS_SCHEDULE_ID, PRESENT)
 VALUES (201610814, 101, 1), 
        (20166884, 101, 0),
        (201610814, , 102, 1),
        (20166884, 102, 1);

The error message I get:

[Exception, Error code 30,000, SQLState 42X80] VALUES clause must contain at least one element. Empty elements are not allowed.

I tried engulfing the 4 "input brackets" into one big bracket for VALUES, but that also didn't work. Any guidance would be appreciated, I'm still quite new to this. Thank you

EDIT: Thank you guys so much. I feel like such a dumbass, I've been staring at this for about an hour and I have no idea how I missed that.. Thank you!!


Solution

  • As already mentioned by Beatrice and Raymond Nijland, you've placed an extra comma (,) in your query.

    Remove the extra comma at (201610814, , 102, 1),