Backticks
- Backticks are used to quote identifiers such as database names, table names, and column names. It is denoted by (“).
- Backticks ensure the identifiers are correctly identified even though they coincide with the MySQL keywords.
- Backticks are especially required if the database/table/column names contain whitespace characters.
Syntax
`Identifier`
MySQL Backticks Example
Let’s fetch the person whose name is Alice using Backticks.
SELECT * FROM `students` WHERE `name` = 'Alice';
Output:
id | name | age |
---|---|---|
1 | Alice | 20 |
Explanation: We have successfully fetched the output along with the help of Backticks easily.
Single Quote, Double Quote, and Backticks in MySQL Queries
Single quotes, double quotes, and backticks are used for specific purposes in MySQL queries. They are mainly used to handle string literals and identifiers.
This guide explains how to use single quotes, double quotes, and backticks in MySQL with syntax and examples.