What is the reason that the following two queries give wildly different results?
MariaDB [mydatabase]> SELECT COUNT(DISTINCT(`price`)) FROM `products`; --
Please find MariaDB's documentation about identifier names and string literals:
https://mariadb.com/kb/en/mariadb/identifier-names/
https://mariadb.com/kb/en/mariadb/string-literals/
Backquotes always quote identifier namens. Single quotes always quote string literals.
Identifier names get replaced by their value, string literals don't:
SELECT `price`, 'price' FROM products;
+-------+-------+
| 1 | price |
| 1 | price |
| 2 | price |
| 3 | price |
| 3 | price |
+-------+-------+