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

James Calby
James Calby
15,153 Points

SQL Code.

I'm working on this in class. I'm a little lost. Can anyone help me with the syntax for this in SQL.

-- 7. Use a number table to loop from 1 to 100 and return the count of DVD within that price range. (hint: Use a scalar sub-query.) Example: DVDs between $1.01 and $2.00 = 209

SELECT dvd.price FROM dvd WHERE price IN (SELECT dvd.price FROM dvd WHERE price >= 1 and price <= 100);

-- 8. Use a number table to loop from 0 to 16. Then include an inline view to find the number of vehicles with the matching number of cylinders built in 2012. Use a case statement to replace null values with a 0. (hint: there were 9 vehicles with 0 cylinders built in 2012.)

Steven Parker
Steven Parker
229,732 Points

The students here will likely not be familiar with the materials you are learning from in class. It looks like you're taking ACCOUNTING 2121 at the University of Hong Kong, but even if my guess is right I've never taken that class myself.

Have you talked to other students in your class, or the teacher or the TA? One of them can probably point you directly to specific pages in the text or moments in a lecture video where you'll find examples that relate directly to these tasks.