How can exceptions in PDO be enabled to improve error handling and debugging in PHP database queries?

To enable exceptions in PDO for improved error handling and debugging in PHP database queries, you can set the `PDO::ATTR_ERRMODE` attribute to `PDO::ERRMODE_EXCEPTION`. This will cause PDO to throw exceptions when errors occur during database operations, making it easier to catch and handle them in your code.

try {
    $pdo = new PDO($dsn, $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    // Your database queries here
    
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}