0

It doesn't like the word release as a column name.

 CREATE TABLE external_db (

      external_db_id          INT not null,
      db_name                     VARCHAR(100) NOT NULL,
      release                    VARCHAR(40)  NOT NULL,
      status                      ENUM ('KNOWNXREF','KNOWN','XREF','PRED','ORTH', 'PSEUDO') not null,

      PRIMARY KEY( external_db_id ) 

    );

Error in MySQLWorkbench

I changed the field name to releaseX and the error went away.

This script came from https://github.com/Ensembl/ensembl/blob/release/91/sql/table.sql, which is supposed to be mySQL. Is this a versioning issue in MySQL or can I decorate the word release in the script so it can be used as a column name?

I am using MySQL 5.7 and MySQLWorkbench 6.3.

I know release is a bad name for a column but I didn't write the script.

nicomp
  • 4,344
  • 4
  • 27
  • 60
  • 1
    Because "release" is a keyword and part of sql commands. https://dev.mysql.com/doc/refman/5.6/en/keywords.html#keywords-5-6-detailed-R – Tyr Jan 12 '18 at 23:22
  • The field is called "db_release" in the file you linked on Github. Just saying. – rlanvin Jan 12 '18 at 23:29
  • @rlanvin You're right. Good catch. I have no idea how I changed that. Thanks! – nicomp Jan 12 '18 at 23:33
  • @nicomp No worries. Feel free to mark my answer as accepted while you're at it. :) – rlanvin Jan 12 '18 at 23:41

1 Answers1

1

Release is a reserved keyword

To use it as a column name, you can escape it with backticks like this:

`release`
rlanvin
  • 6,057
  • 2
  • 18
  • 24