title: How to count unique records and get number of these uniques in table using SQL?
body: <p>Imagine I have table like this:</p>
  
  <p><strong>id:Product:shop_id</strong></p>
  
  <p>1:Basketball:41</p>
  
  <p>2:Football:41</p>
  
  <p>3:Rocket:45</p>
  
  <p>4:Car:86</p>
  
  <p>5:Plane:86</p>
  
  <p>Now, this is an example of large internet mall, where there are shops which sell to one customer, so customer can choose more products from each shop and buy it in one basket.</p>
  
  <p>However, I am not sure if there is any SQL syntax which allows me to simply get unique shop_ids and total number of those shops' products in customer basket. So I'd get something like:</p>
  
  <p>Shop 41 has 2 products</p>
  
  <p>Shop 45 one product</p>
  
  <p>Shop 86 two product</p>
  
  <p>I can make SQL queries to scoop through table to make some kind of  ['shop_id']['number_of_products'] array variable that would store all products' shop_ids, then "unique them" - up and count how many times I had to cut one more shop_id out to have some remaining but that just seems as a lot of useless scripting.</p>
  
  <p>If you got some nice and neat idea, please, let me know.</p>