@@ -180,12 +180,69 @@ query = SQLQuery("""
180180results = index.query(query)
181181```
182182
183+ ** Aggregations and grouping:**
184+
185+ ``` python
186+ query = SQLQuery("""
187+ SELECT category, COUNT(*) as count, AVG(price) as avg_price
188+ FROM products
189+ GROUP BY category
190+ ORDER BY count DESC
191+ """ )
192+ ```
193+
194+ ** Geographic queries** with ` geo_distance() ` :
195+
196+ ``` python
197+ # Find stores within 50km of San Francisco
198+ query = SQLQuery("""
199+ SELECT name, category
200+ FROM stores
201+ WHERE geo_distance(location, POINT(-122.4194, 37.7749), 'km') < 50
202+ """ )
203+
204+ # Calculate distances
205+ query = SQLQuery("""
206+ SELECT name, geo_distance(location, POINT(-122.4194, 37.7749)) AS distance
207+ FROM stores
208+ """ )
209+ ```
210+
211+ ** Date queries** with ISO date literals and date functions:
212+
213+ ``` python
214+ # Filter by date range
215+ query = SQLQuery("""
216+ SELECT name FROM events
217+ WHERE created_at BETWEEN '2024-01-01' AND '2024-03-31'
218+ """ )
219+
220+ # Extract date parts
221+ query = SQLQuery("""
222+ SELECT YEAR(created_at) AS year, COUNT(*) AS count
223+ FROM events
224+ GROUP BY year
225+ """ )
226+ ```
227+
228+ ** Vector similarity search** with parameters:
229+
230+ ``` python
231+ query = SQLQuery("""
232+ SELECT title, vector_distance(embedding, :vec) AS score
233+ FROM products
234+ LIMIT 5
235+ """ , params = {" vec" : embedding_bytes})
236+ ```
237+
183238Use when your team is more comfortable with SQL syntax, or when integrating with tools that generate SQL.
184239
185240``` {note}
186241SQLQuery requires the optional `sql-redis` package. Install with: `pip install redisvl[sql-redis]`
187242```
188243
244+ For comprehensive examples including geographic filtering, date functions, and vector search, see the [ SQL to Redis Queries guide] ( ../user_guide/12_sql_to_redis_queries.ipynb ) .
245+
189246## Choosing the Right Query
190247
191248| Use Case | Query Type |
0 commit comments