1

I know it's a silly question
But I'm curious to know the difference in SQL Between using This ` and not using it, and what's the best.
For Example :
What is the difference between

SELECT * FROM `Table` WHERE ....

and

SELECT * FROM Table WHERE ....
Hema D.
  • 140
  • 2
  • 5
  • 17
  • 1
    You can name your table `\`Some Data?!\`` or `\`SELECT\`` without backticks it will result in a syntax error. – n00dl3 Jul 15 '18 at 13:25
  • 1
    `Table` is a reserved word - so the second statement will not work. – Paul Spiegel Jul 15 '18 at 13:27
  • Ok, Got it ! Thanks, Guys – Hema D. Jul 15 '18 at 13:31
  • 1
    @IncredibleHat Did you read the very first sentence? "Backticks are to be used for table and column identifiers, but are only necessary when the identifier is a MySQL **reserved keyword**, or [..]". BTW: New versions can introduce new reserved words. For example `empty` didn't need to be backticked until 8.0. You just can't know what will be reserved in the next version. – Paul Spiegel Jul 15 '18 at 14:01
  • 1
    @PaulSpiegel ... I should have had my meds before reading SO this morning. Thanks for pointing that out =p – IncredibleHat Jul 15 '18 at 14:04

1 Answers1

1

Essentially, making use of backticks can allow you to use alternative characters. In cases where you are writing queries it's mostly alright , but if you want to include strange names and characters it can make you get away with it. You should keep in mind that they don't work with SQL SERVER, they are not part of the ANSI SQL. Finally, one of the positive attributes that can provide is that enable you to search more easily for the words you have with these in your code.

gsa
  • 790
  • 1
  • 8
  • 20