ODBC Driver for Redis

Build 22.0.8462

SELECT Statements

The CData ODBC Driver for Redis is SQL-92 compliant. Below are some example SELECT statements.

  1. Return all columns:
    SELECT * FROM Customers
  2. Rename a column:
    SELECT [CompanyName] AS MY_CompanyName FROM Customers
  3. Search data:
    SELECT * FROM Customers WHERE Country = 'US';
  4. Return the number of items in a group:
    SELECT COUNT(*) AS MyCount FROM Customers
  5. Return the number of unique items in a group:
    SELECT COUNT(DISTINCT CompanyName) FROM Customers
  6. Summarize data:
    SELECT CompanyName, MAX(Balance) FROM Customers GROUP BY CompanyName
  7. Retrieve data from multiple tables.
    SELECT Restaurants.name, Zips.city FROM Restaurants INNER JOIN Zips ON Restaurants.zipcode = Zips.id
    See JOIN Queries for details.
  8. Sort a result set in ascending order:
    SELECT City, CompanyName FROM Customers ORDER BY CompanyName ASC
  9. Restrict a result set to the specified number of rows:
    SELECT City, CompanyName FROM Customers LIMIT 10 
  10. Parameterize a query to pass in inputs at execution time. This enables you to create prepared statements and mitigate SQL injection attacks.
    SELECT * FROM Customers WHERE Country = @param
See the Explicitly Caching Data section for information in using the SELECT statement in offline mode.

Pseudo Columns

Some input-only fields are available in SELECT statements. These fields, called pseudo columns, do not appear as regular columns in the results, yet may be specified as part of the WHERE clause. You can use pseudo columns to access additional features from Redis.

SELECT * FROM Customers WHERE MyPseudocolumn = [MyValue];

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462