Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Reporting with SQL Date and Time Functions Today's Report

Kevin Haller
Kevin Haller
5,940 Points

Mistake in task definition. The query wants to find out all orders, which were shipped today.

SELECT COUNT(*) AS "shipped_today" FROM orders WHERE shipped = DATE("now");

does yield a result of 0.

So <shipped> needs to have the value of "shipped" and we need to find the column with the numeric value of DATE("now"). The only column, that would come into consideration is <ordered_on>.

SELECT COUNT(*) AS "shipped_today" FROM orders WHERE ordered_on = DATE("now") AND status = "shipped";

yields the correct answer of 13 however, now we don't have all the orders that have been marked as "shipped" today, but all orders that have been marked as "ordered" today, which is a difference.

Am I right or do I miss something?

Patrik Horváth
Patrik Horváth
11,110 Points

check question again : In an ecommerce database there's an orders table with the columns id, product_id, user_id, address_id, ordered_on, status and cost.

it clearly tells you with collums you have in table and Logic tell you shipped should be true or false or text because if you have ordered_on collumn in table =\

but who know every one have other thinking

1 Answer

Steven Parker
Steven Parker
231,184 Points

I also found the language of the instructions a bit confusing. I reworded it slightly for myself to say, "Count the total number of orders that have the status of shipped that were ordered today."

You might want to report this as a bug to Support.