John Woo
John Woo

Reputation: 263733

What is the meaning of grave accent (AKA backtick) quoted characters in MySQL?

I was wondering why some tutorials and other MySQL management tools use grave accent (`) in their queries like this one below:

SELECT `TableA`.`FieldA`, `TableA`.`FieldB`, `TableA`.`FieldC` 
FROM `Databasename`.`TableA`

When it displays the same result with this query below:

SELECT FieldA, FieldB, FieldC
FROM TableA

Upvotes: 41

Views: 14679

Answers (1)

OMG Ponies
OMG Ponies

Reputation: 332591

The grave is more commonly referred to as a "backtick", which MySQL uses to escape MySQL reserved words.

Wrapping everything in backticks is very common in PHPMyAdmin and various examples because most would rather name tables and columns whatever they like without worrying about naming errors. I don't agree with the practice personally...

Upvotes: 53

Related Questions