JSON/q

A JSON-based data access specification

Query

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

Results

[
  {
    "category": "Beverages", 
    "mostExpensivePrice": 263.5
  }, 
  {
    "category": "Condiments", 
    "mostExpensivePrice": 43.9
  }, 
  {
    "category": "Produce", 
    "mostExpensivePrice": 53.0
  }, 
  {
    "category": "Meat/Poultry", 
    "mostExpensivePrice": 123.79
  }, 
  {
    "category": "Seafood", 
    "mostExpensivePrice": 62.5
  }, 
  {
    "category": "Dairy Products", 
    "mostExpensivePrice": 55.0
  }, 
  {
    "category": "Confections", 
    "mostExpensivePrice": 81.0
  }, 
  {
    "category": "Grains/Cereals", 
    "mostExpensivePrice": 38.0
  }
]