How can the BETWEEN operator be utilized in the provided SQL query for better readability and efficiency?

To improve the readability and efficiency of the SQL query, the BETWEEN operator can be used to simplify the range comparison condition. This operator allows for a more concise and easier to understand query, especially when dealing with range comparisons. By using the BETWEEN operator, the query becomes more efficient as it reduces the need for multiple comparison operators.

$sql = "SELECT * FROM products WHERE price BETWEEN 10 AND 50";
$result = mysqli_query($connection, $sql);

if (mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        echo "Product: " . $row['product_name'] . " - Price: $" . $row['price'] . "<br>";
    }
} else {
    echo "No products found within the specified price range.";
}