Jump to content

Problem with Syntax?


Styles2304

Recommended Posts

Here's the code I ran to setup my DB table: BonusInfo

 

CREATE TABLE `black_arku`.`BonusInfo` (`IndexNo` SMALLINT NOT NULL ,`Bonus` TEXT NOT NULL ,`History` TEXT NOT NULL ,INDEX ( `IndexNo` ));

 

And then here is the insert statement I'm trying to execute but I'm getting a syntax error:

 

INSERT INTO `black_arku` . `BonusInfo` VALUES (1, '0', '0');

 

Is there something I'm missing?

Link to comment
Share on other sites

try this.

INSERT INTO Name_of_the_table (black_arku , BonusInfo) VALUES ('1','0');

 

i removed one 0 because i don't understand if 2 fields are given why u are trying to insert 3 sets of data. The 1 corresponds to the field black_arku and the 0 to Bonusinfo in this example.

Link to comment
Share on other sites

OK

INSERT INTO Bonusinfo (IndexNo, Bonus, History) VALUES ('1','0','0');

 

This is the way  your query should look.

 

INSERT INTO Tablename (Fieldname, Fieldname, Fieldname) VALUES ('value','Value','Value');

 

Connection to the database should be made earlier.

 

 

 

 

Link to comment
Share on other sites

OK

INSERT INTO Bonusinfo (IndexNo, Bonus, History) VALUES ('1','0','0');

 

This is the way  your query should look.

 

INSERT INTO Tablename (Fieldname, Fieldname, Fieldname) VALUES ('value','Value','Value');

 

Connection to the database should be made earlier.

 

 

 

 

 

 

It is perfectly valid, acceptable and even semi-common to not select a database.

 

 

The full name of a table can be used in a statement.

 

 

INSERT INTO database.table.....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.