Doubt insert MySQL

1

Good morning,  I'm trying to make an insert, plus this giving error and seems to be in the field hour, could help me identify what's wrong:  Here is the insert and the error.

INSERT INTO senhas 
                                                 (senha_id,
                                                  senha_setor_id,
                                                  senha_tipo_id,
                                                  senha_numero,
                                                  senha_data,
                                                  senha_hora)
                                          VALUES 
                                                 ('1',
                                                  '1',
                                                  '1',
                                                  '1',
                                                  '2016-03-01',
                                                  '10:03:00');

Follow the return:

  

Error Code: 1064. You have an error in your SQL syntax; check the   manual that corresponds to your MySQL server version for the right   syntax to use near '' at line 14 0.000 sec

The fields are:

senha_id        = int (11) 
senha_setor_id  = int (11) 
senha_tipo_id   = int (11)
senha_numero    = int (11) 
senha_data      = date 
senha_hora      = time

As indicated by our colleague @jbueno were removed from the 'int' fields.

INSERT INTO senhas
                                             (senha_id,
                                              senha_setor_id,
                                              senha_tipo_id,
                                              senha_numero,
                                              senha_data,
                                              senha_hora)
                                      VALUES 
                                             ('',
                                              1,
                                              1,
                                              1,
                                              '2016-03-01',
                                              '10:03:00');
    
asked by anonymous 01.03.2016 / 14:20

1 answer

3

You are entering all fields as varchar .

Your insert should look like this

INSERT INTO senhas 
     (senha_id,
      senha_setor_id,
      senha_tipo_id,
      senha_numero,
      senha_data,
      senha_hora)
VALUES 
     (1,
      1,
      1,
      1,
      STR_TO_DATE('01, 03, 2016','%d,%m,%Y'),
      STR_TO_DATE('10:03:00','%h:%i:%s'));
    
01.03.2016 / 14:32