0

While searching for an answer to another problem, I found an answer (https://stackoverflow.com/a/32634993) containing a Insert-SQL-statement with a word in single quotation marks in the attribute-enumeration. I have never seen this before. Dose it have any purpose or is it just a mistake by the author of the comment?

See " 'order' ":

INSERT INTO table_name (name_first, name_last, `order`)
VALUES (....);
Shadow
  • 33,525
  • 10
  • 51
  • 64
Adler
  • 2,648
  • 2
  • 11
  • 16

1 Answers1

1

order is a reserved word in MySQL and a keyword in SQL. That makes it a really bad choice for a column name.

But someone chose it anyway. Sigh.

The backticks escape the column name so it is not confused with the order in order by.

As a note: There is a mistake, but the mistake is in allowing a name such as order for a column. I mean, even ordering is fine.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • "but the mistake is in allowing a name such as order for a column" is simply not true.... But it is advise not to use a reserved word. – Luuk May 09 '21 at 18:18