skip to Main Content
CREATE TABLE ACUPAN (
    EMP_NO INT ,
    SURNAME VARCHAR (20),
    FIRSTNAME VARCHAR (20),
    DEPARTMENT VARCHAR (20),
    RATEPERDAY INT,
    NOMOFWORK INT,
    SALARY INT,
    
);
SELECT*FROM ACUPAN;

INSERT INTO ACUPAN VALUES (30012,'AVILES', 'KATE', 'HRD' , 740, ,12);

Why i cant insert this DATA in my column?

enter image description here

2

Answers


  1. In your insert statement you have a 2 commas near the end of the statement 740, ,12);. Basically, the MySQL expects to have a value between those empty commas.

    change this

    INSERT INTO ACUPAN VALUES (30012,'AVILES', 'KATE', 'HRD' , 740, ,12);
    

    into this

    INSERT INTO ACUPAN VALUES (30012, 'AVILES', 'KATE', 'HRD', 740, 0, 12); 
                                                               -- ^ only one comma here
    

    I put 0 as the value of NOMOFWORK column because its type is INT and it doesn’t have a default value. You should put the right value instead of 0.

    Login or Signup to reply.
  2. You should use

    INSERT INTO ACUPAN VALUES (30012,'AVILES', 'KATE', 'HRD' , 740, 0, 12);
    

    OR

    INSERT INTO ACUPAN VALUES (30012,'AVILES', 'KATE', 'HRD' , 740, NULL, 12);
    

    You can’t have an empty value between comma’s.
    You can define its empty by putting NULL or 0 in case of an integer or "" in case of a string

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search