0

I want to add this to the existing table in my database, but I get this error!

ALTER TABLE renting ADD renting_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' , ADD payment_amount DOUBLE(10) NOT NULL , ADD pay_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' , ADD pay_due_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' , ADD debts DOUBLE(10) NOT NULL ;

What's the error here?

#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 ') NOT NULL , ADD pay_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' , ' at line 1

Weak to Enuma Elish
  • 4,622
  • 3
  • 24
  • 36
Muna
  • 19
  • 6

2 Answers2

0

Try This

ALTER TABLE renting ADD renting_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', 
ADD payment_amount INT(10) NOT NULL, 
ADD  pay_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', 
ADD pay_due_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' , 
ADD debts INT(10) NOT NULL;
Vipin Jain
  • 3,686
  • 16
  • 35
0

Try This :

 ALTER TABLE renting  
       ADD COLUMN renting_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', 
       ADD COLUMN payment_amount DOUBLE(10) NOT NULL,
       ADD COLUMN pay_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
       ADD COLUMN pay_due_date TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
       ADD COLUMN debts DOUBLE(10) NOT NULL ;

check this Adding multiple columns in MySQL with one statement

Community
  • 1
  • 1
safin chacko
  • 1,345
  • 1
  • 11
  • 18