SA-MP Forums Archive
SQL table creation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL table creation (/showthread.php?tid=462179)



SQL table creation - Fernado Samuel - 05.09.2013

Hello!
I have a simple doubt about creating SQL table.

I had made a MySQL R6 script some months ago and now i would like to add some more fields in the table.
The problem is there are currently 5000+ users has registered and i don't want to loose those accounts.

So, is it possible to create more fields into the current database table?

Please try to respond as soon as possible..

Thank you.


Re: SQL table creation - WopsS - 05.09.2013

Yes, it is possible! For every users in your database, when you create more field, it will add default value 0, or what you set as default.


Re: SQL table creation - Fernado Samuel - 05.09.2013

Quote:
Originally Posted by WopsS
Посмотреть сообщение
Yes, it is possible! For every users in your database, when you create more field, it will add default value 0, or what you set as default.
Oh that would be good, but how may i create extra fields?


Re: SQL table creation - Tomer!.$ - 05.09.2013

ALTER TABLE table_name
ADD column_name datatype


Re: SQL table creation - MagedXp - 05.09.2013

ALTER TABLE "TableName" ADD "newfiledname" int(10) NOT NULL DEFAULT '0';
without quotes
example :
ALTER TABLE Users ADD Money int(10) NOT NULL DEFAULT '0';

hope it works


Re: SQL table creation - Fernado Samuel - 05.09.2013

Thank you both, i couldn't give rep due to my past behavior


AW: SQL table creation - BigETI - 05.09.2013

phpmyadmin allows you to manage your databases much easier.