Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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!