14. Aug 2020 |

Charset ja collation MySQL-is

Vaikimisi charset utf8_general_ci

Kui te pole MySQL-i erinevate tähestiku reeglistikkude toetustega kursis, siis on kindlasti soovitatav kasutada vaikimisi kuvatavat reeglistikku, milleks on collation latin1_swedish_ci.

Kasulik

DROP TABLE clients;
DELETE FROM product_type;

SELECT YEAR(date), MONTH(date), products.brand, SUM(qty), type, warehouse 
FROM sales 
INNER JOIN products ON sales.sku = products.sku
GROUP BY brand, MONTH(date)
ORDER BY YEAR(date), MONTH(date);

SELECT MONTH(date), SUM(qty * price_w_vat) from sales
WHERE MONTH(date) = 7;

SELECT MONTH(date), SUM(qty), SUM(qty * price_w_vat) from sales
GROUP BY MONTH(date);

Leave a Reply

Your email address will not be published. Required fields are marked *