JSON/q

A JSON-based data access specification

Query

{
  "group": {
    "into": "g", 
    "by": "p.category"
  }, 
  "as": "p", 
  "from": "Products", 
  "select": {
    "category": "g.key", 
    "cheapestPrice": "g.min(p.unitPrice)"
  }
}

Results

[
  {
    "category": "Beverages", 
    "cheapestPrice": 4.5
  }, 
  {
    "category": "Condiments", 
    "cheapestPrice": 10.0
  }, 
  {
    "category": "Produce", 
    "cheapestPrice": 10.0
  }, 
  {
    "category": "Meat/Poultry", 
    "cheapestPrice": 7.45
  }, 
  {
    "category": "Seafood", 
    "cheapestPrice": 6.0
  }, 
  {
    "category": "Dairy Products", 
    "cheapestPrice": 2.5
  }, 
  {
    "category": "Confections", 
    "cheapestPrice": 9.2
  }, 
  {
    "category": "Grains/Cereals", 
    "cheapestPrice": 7.0
  }
]