1

I would really appreciate some help. Got this error importing the database:

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 ')'

Here is the code which gives error:

CREATE TABLE `c9soa_assets` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'Primary Key',
  `parent_id` int(11) NOT NULL DEFAULT '0'COMMENT
) ;
3
  • If we can't see the whole query, then we can't really help. Commented Aug 22, 2016 at 8:29
  • 1
    If you need a quick place to play with a particular CREATE TABLE statement, try SQL Fiddle. You may wish to declare id as an explicit primary key, incidentally - look online for examples, and try them out for your case. Commented Aug 22, 2016 at 17:07
  • thank you @halfer, I'll definitely try it out Commented Aug 23, 2016 at 16:34

2 Answers 2

2

You need to specify a comment after that last COMMENT, or remove it.

Sign up to request clarification or add additional context in comments.

4 Comments

Hi @jason_c, thank you for your time, but removing totally or adding the comment gives me another error: #1054 - Unknown column 'lft' in 'field list'
@Anna That error is unrelated to your COMMENT problem. It means exactly what it says and at this point you're going to have to check your database structure and possibly back up and run through some SQL tutorials. That error means your table has no column with that name and it doesn't even appear to be related to the query you posted. To be blunt, unless you put some effort into learning how to use the tools you are using, there isnt much anybody else can do to help you and youre going to continue struggling.
You are right, I have no idea what I'm doing, just needed to move the database (for my Joomla site) from localhost to server and I got this error. It never happened before, I googled it but nothing made sense to me. It is obvious that I have to learn it. But for now, just wanted some help. I appreciate your time.
@Anna It sounds like you may not have actually set up your local database yet, just a guess. Your first step should be to duplicate your old remote db locally. Usually db management interfaces have an export and import option, where you can e.g. export the original structure and data to SQL, then run that query on the new server to recreate the database. I dunno what your specific situation is but be sure you've copied your old database correctly, none of your queries will work if you dont. For MySQL you can do it through the command line or phpmyadmin. Google for copying mysql databases.
1

You need to add comment like,

CREATE TABLE `c9soa_assets` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'Primary Key',
  `parent_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Parent Id'
) ;

3 Comments

thank you @Rohan-Kumar but still gives me another error: #1054 - Unknown column 'lft' in 'field list'
Are you executing INSERT query.
@AnnaDrybulska: if this is a different question, please ask a new question. That doesn't seem to be related to this table, since it is related to a field lft that you have not shown us.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.