Home > database >  Mysql - form as a field name in integer problem
Mysql - form as a field name in integer problem

Time:09-30

Create a table, use the workbench manually add fields, as a field name in integer, feasible,
Use SQL statements ALTER TABLE test0102 ADD COLUMN 102 FLOAT; No,
Tip Error: 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 1 '102 FLOAT'

Using the mysql5.5 version,
There are a few questions:
1, using dynamic SQL statements add integer as the name of the field, not feasible?
2, set up form, whether it is not recommended to integer to name field?
3, is there any way can realize the dynamic increase integer name field?

Have encountered the same problem or experienced, please comment

CodePudding user response:

Use the quotation marks
The ALTER TABLE test0102 ADD COLUMN, 102, FLOAT;

CodePudding user response:

Generally is not recommended in digital field name, where used to add the quotes, appear trouble
Dynamically add that statement is executed directly you
Use the workbench, also have generated operating statements for you, you pay attention to

CodePudding user response:

Do not recommend using integer as a column name or show that cannot represent the meaning of the column of
The time like to name the child's name will not in the same way as a digital

Only to prisoners to take digital code,,,

CodePudding user response:

refer to the second floor ZJCXC response:
usually do not recommended in digital field name, use the place to add the quotes, appear trouble
Dynamically add that statement is executed directly you
With the workbench, also have generated operating statements for you, you was clear to pay attention to the

Add the quotes can indeed! Thank you ~
The present scheme using integer as a field name, see the effect first, don't know the dynamic change table structure to increase a lot of field has no effect

CodePudding user response:

The
reference 3 floor rucypli response:
do not recommend using integer as the column name or show that cannot represent the meaning of the column of
The time like to name the child's name will not in the same way as a digital

Digital code, only to prisoners to begin,,


Ha ha now try whether the scheme will go through first

CodePudding user response:

With digital column names is not very convenient in the future

CodePudding user response:

refer to 6th floor luxooq response:
made column names is not very convenient in the future digital

Didn't do it before, you said not convenient, can be more specific, like what?
  • Related