0

I am running a sql and I am getting the error.

insert into pfam_uniprot (UniProtKB-AC, UniProtKB-ID, GeneID, RefSeq, GI, PDB, GO, IPI, UniRef100, UniRef90, UniRef50, UniParc, PIR, NCBI-taxon, MIM, UniGene, PubMed, EMBL, EMBL-CDS, Ensemble, Ensemble-TRS, Ensemble-PRO, Additional_PubMed) values ("Q6GZX4", "001R_FRG3G", "2947773", "YP_031579.1", "81941549,47060116,49237298", "", "GO:0006355,GO:0046782,GO:0006351", "", "UniRef100_Q6GZX4", "UniRef90_Q6GZX4", "UniRef50_Q6GZX4", "UPI00003B0FD4", "", "654924", "", "", "15165820", "AY548484", "AAT09660.1", "", "", "", "")

I am getting error as :

(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 '-AC, UniProtKB-ID, GeneID, RefSeq, GI, PDB, GO, IPI, UniRef100, UniRef90, UniRef' at line 1")I am not able to understand. Can anyone let me know.

Thanks

2 Answers 2

1

You cannot have hyphens in variable names. You need to escape them. I would use double quotes for the variable names and single quotes for the string values:

insert into pfam_uniprot values ("UniProtKB-AC", "UniProtKB-ID", GeneID, RefSeq, GI, PDB, GO,
                                 IPI, UniRef100, UniRef90, UniRef50, UniParc, PIR, "NCBI-taxon",
                                 MIM, UniGene, PubMed, EMBL, "EMBL-CDS", Ensemble, "Ensemble-TRS",
                                 "Ensemble-PRO", Additional_PubMed
                                )
    values ('Q6GZX4', '001R_FRG3G', '2947773', 'YP_031579.1', '81941549,47060116,49237298', '',
            'GO:0006355,GO:0046782,GO:0006351', '', 'UniRef100_Q6GZX4', 'UniRef90_Q6GZX4',
            'UniRef50_Q6GZX4', 'UPI00003B0FD4', '', '654924', '', '', '15165820', 'AY548484',
            'AAT09660.1', '', '', '', '');
Sign up to request clarification or add additional context in comments.

1 Comment

Note that MySQL (incorrectly) treats double-quoted strings as being string literals instead of schema names. You can fix it by enabling the ANSI_QUOTES flag in sql_mode, or use backticks instead of double-quotes (but this isn't compatible with other databases).
1

Remove the first values:

insert into pfam_uniprot values (
                         ^^^^^^

2 Comments

after removing that also it says : (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 '-AC, UniProtKB-ID, GeneID, RefSeq, GI, PDB, GO, IPI, UniRef100, UniRef90, UniRef' at line 1")
@sam, Are the field names correct? They contains - in between. Maybe you need escape them using backtick(`) or quote(" or ').

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.