For example, if I had a table of DVDs people owned, like this
OWNER TITLE
---------------------------------
Jennifer | Ghostbusters
Jennifer | Jurassic Park
Alex | Titanic
Jennifer | Aliens
Jack | Seinfeld
Jack | Baby's Day Out
Alex | Jurassic Park
And I wanted to get a count of how many rows each OWNER had, like
Jennifer | 3
Alex | 2
Jack | 2
How would I do that? I know how to count how many OWNERs there are, but not how many rows each OWNER has. So far I've been using multiple statements -- select owner(distinct owner), make an array of the returned names, then issue a "select count from table where owner = array[i]" for each item in the array -- but that doesn't seem like the smart way of doing it.