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 Aggregate and Numeric Functions Counting Results

COUNT(*) With Limit

The total amount of rows returned after limit will be say 5 than how come, count(*) can be 6? Didn't get it, can someone please help me?

1 Answer

Dustin Honeck
Dustin Honeck
12,497 Points

Hi Rushabha, the LIMIT keyword only limits the number of returned results from your query but does not limit your table's data. So the COUNT keyword is counting the number of rows in your entire table and will return a single row containing your query results. The LIMIT keyword is used to limit the number of results that your query will return and since only one will be returned and it is less than 5, no rows will be removed from your query results. Hope that helps!