Using Deltaray's Query Language
Last updated August 14, 2024
Deltaray's intuitive query language provides a powerful means to extract specific data, perform calculations, and analyze your information. This language allows you to ask questions of your data and obtain customized results.
Deltaray Query Language Basics
- Selecting Data:
- `SELECT` statement: Use this to specify which columns (fields) you want to retrieve.
- `FROM` clause: Indicate the dataset (table) you're querying.
- Example: `SELECT name, email FROM customers`
- Filtering Data:
- `WHERE` clause: Add conditions to filter rows based on specific criteria.
- Comparison Operators: Use `=`, `!=`, `>`, `<`, `>=`, `<=` to compare values.
- Example: `SELECT name, email FROM customers WHERE age > 25`
- Grouping Data:
- `GROUP BY` clause: Group rows based on one or more columns.
- Aggregation Functions: Use functions like `SUM()`, `AVG()`, `MAX()`, `MIN()`, `COUNT()` to aggregate data within each group.
- Example: `SELECT gender, COUNT(*) AS customer_count FROM customers GROUP BY gender`
- Sorting Data:
- `ORDER BY` clause: Sort the results based on one or more columns.
- `ASC` (ascending) or `DESC` (descending) order.
- Example: `SELECT name, age FROM customers ORDER BY age DESC`
- Joining Data:
- `JOIN`: Combine data from multiple datasets based on a shared column.
- Types of Joins:
- `INNER JOIN`: Returns rows that have matching values in both datasets.
- `LEFT JOIN`: Returns all rows from the left dataset, plus matching rows from the right dataset.
- `RIGHT JOIN`: Returns all rows from the right dataset, plus matching rows from the left dataset.
- `FULL OUTER JOIN`: Returns all rows from both datasets.
- Example: `SELECT * FROM customers INNER JOIN orders ON customers.customer_id = orders.customer_id`
- Using Subqueries:
- Subqueries: Embed nested queries within your main query to filter or retrieve specific values.
- Example: `SELECT * FROM customers WHERE age >= (SELECT AVG(age) FROM customers)`
- Aliasing:
- Use `AS` to give columns or datasets temporary aliases to make your queries easier to read.
- Example: `SELECT name AS customer_name, email AS customer_email FROM customers`
- Functions: Deltaray provides a variety of built-in functions:
- Mathematical: `SUM()`, `AVG()`, `MIN()`, `MAX()`, `COUNT()`, `ABS()`, `ROUND()`, etc.
- String: `UPPER()`, `LOWER()`, `SUBSTR()`, `REPLACE()`, `CONCAT()`, etc.
- Date and Time: `DATE()`, `YEAR()`, `MONTH()`, `DAY()`, `HOUR()`, `NOW()`, etc.
Deltaray's query language allows you to harness the full potential of your data, retrieving and manipulating data based on your specific needs. You can write these queries directly into Deltaray or use the visual query builder for a more interactive approach.
Was this article helpful?