Should table names and columns be enclosed in backticks in PDO queries in PHP?

When writing PDO queries in PHP, it is not necessary to enclose table names and columns in backticks. However, if your table or column names contain reserved keywords or special characters, it is recommended to enclose them in backticks to avoid any syntax errors.

// Example of using backticks for table and column names in a PDO query
$tableName = 'users';
$columnName = 'user_id';

$query = $pdo->prepare("SELECT `{$columnName}` FROM `{$tableName}` WHERE `{$columnName}` = :id");
$query->bindParam(':id', $userId);
$query->execute();