このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。
Overview SQL in Analysis cells allows you to analyze and manipulate data within Log Workspaces. This documentation covers the SQL support available in Log Workspaces and includes:
Syntax The following SQL syntax is supported:
Syntax Description Example SELECT (DISTINCT)
DISTINCT: OptionalRetrieves rows from a database, with DISTINCT
filtering out duplicate records.
Copy
SELECT DISTINCT customer_id
FROM orders
JOIN
Combines rows from two or more tables based on a related column between them.
Copy
SELECT orders . order_id , customers . customer_name
FROM orders
JOIN customers
ON orders . customer_id = customers . customer_id
GROUP BY
Groups rows that have the same values in specified columns into summary rows.
Copy
SELECT product_id , SUM ( quantity )
FROM sales
GROUP BY product_id
WHERE
Includes support for LIKE
filters on strings for pattern matching.Filters records that meet a specified condition.
Copy
SELECT *
FROM employees
WHERE department = 'Sales' AND name LIKE 'J%'
CASE
Provides conditional logic to return different values based on specified conditions.
Copy
SELECT order_id ,
CASE
WHEN quantity > 10 THEN 'Bulk Order'
ELSE 'Standard Order'
END AS order_type
FROM orders
Arithmetic Operations Performs basic calculations using operators like +
, -
, *
, /
.
Copy
SELECT price , tax , ( price * tax ) AS total_cost
FROM products
Functions The following SQL functions are supported:
Function Description Example MIN
Returns the smallest value in a set of data.
Copy
SELECT MIN ( response_time ) AS min_response_time
FROM logs
WHERE status_code = 200
MAX
Returns the maximum value across all input values.
Copy
SELECT MAX ( response_time ) AS max_response_time
FROM logs
WHERE status_code = 200
COUNT
Returns the number of input values that are not null.
Copy
SELECT COUNT ( request_id ) AS total_requests
FROM logs
WHERE status_code = 200
SUM
Returns the summation across all input values.
Copy
SELECT SUM ( bytes_transferred ) AS total_bytes
FROM logs
GROUP BY service_name
AVG
Returns the average value (arithmetic mean) across all input values.
Copy
SELECT AVG ( response_time )
AS avg_response_time
FROM logs
WHERE status_code = 200
GROUP BY service_name
CEIL
/CEILING(numerical column)
Returns the value rounded up to the nearest integer.
Copy
SELECT CEIL ( price ) AS rounded_price
FROM products
FLOOR
Returns the value rounded down to the nearest integer.
Copy
SELECT FLOOR ( price ) AS floored_price
FROM products
ROUND
Returns the value rounded to the nearest integer.
Copy
SELECT ROUND ( price ) AS rounded_price
FROM products
LOWER
Returns the string as lower case.
Copy
SELECT LOWER ( customer_name ) AS lowercase_name
FROM customers
UPPER
Returns the string as uppercase.
Copy
SELECT UPPER ( customer_name ) AS uppercase_name
FROM customers
ABS
Returns the absolute value.
Copy
SELECT ABS ( balance ) AS absolute_balance
FROM accounts
COALESCE
Returns the first non-null value.
Copy
SELECT COALESCE ( phone_number , email ) AS contact_info
FROM users
Further reading