Error trying to add a double column in mysqli

Asked

Viewed 113 times

0

I need to add some columns to my mysqli that according to the wamp is the version 5.7.26 because I am doing the integration with paid market, however, I realize that regardless of the way I create my table, soon after adding the 'date' column of type date, I get the following error:

1064 - you have a syntax error in your SQL next to ') NOT NULL AFTER data on line 1.

And the indicated command that points to this error is as follows:

ALTER TABLE `fatura`  ADD `valor` DOUBLE(255) NOT NULL  AFTER `data`;

I am using the graphical interface to add columns, I don’t understand how it can be possible that an error occurs by typing SQL commands, as if I were running them manually

Here is my SQL

DROP TABLE IF EXISTS `fatura`;
CREATE TABLE IF NOT EXISTS `fatura` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` varchar(20) NOT NULL,
  `ref` varchar(255) NOT NULL,
  `forma` varchar(255) NOT NULL,
  `data` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
COMMIT;
  • 2

    ALTER TABLE fatura ADD valor DOUBLE NOT NULL AFTER data; https://www.db-fiddle.com/f/sWnCukrctrWnAnhiggS3vi/0

  • thank you, gave it right :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.