How can I write a query which will return the orders created per day for a time range let me say (according to the example code I've provided) 2016-02-01 - 2016-02-28. In result I want to include all days of this range including the days for which there is no order created (day_with_no_order will return zero as a line result). The problem I face is how to specify this day-counting-range. I'm using MySQL but this should be a general problem not vendor-specific.
DROP TABLE IF EXISTS orders;
CREATE TABLE orders ( id INT NOT NULL, date_created DATE NOT NULL, items_quantity INT NOT NULL );
INSERT INTO orders VALUES
(1, STR_TO_DATE('2016-02-03','%Y-%m-%d'), 1),
(2, STR_TO_DATE('2016-02-04','%Y-%m-%d'), 2),
(3, STR_TO_DATE('2016-02-05','%Y-%m-%d'), 3),
(4, STR_TO_DATE('2016-02-05','%Y-%m-%d'), 1),
(5, STR_TO_DATE('2016-02-10','%Y-%m-%d'), 2),
(6, STR_TO_DATE('2016-02-12','%Y-%m-%d'), 3),
(7, STR_TO_DATE('2016-02-19','%Y-%m-%d'), 1),
(8, STR_TO_DATE('2016-02-19','%Y-%m-%d'), 2),
(9, STR_TO_DATE('2016-02-21','%Y-%m-%d'), 3);