I’m building an e-shop using RDBMS, and wanted to know what is the most efficient way to represent the number of items in a particular category? So for instance, my category menu would look something like this:
- Books (212)
- MP3 players (13)
- Footwear (562)
What techniques do you use to get those numbers? I’m using PostgreSQL 9.1, but I assume the mechanics should be similar throughout all DBMSs.
You need
GROUP BYThis will count the number of items in the table for each category.