diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md index 3af4e9a17c..b315f40d9c 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/10-udf/ddl-create-function.md @@ -187,3 +187,53 @@ export function calculateAge(birthDateStr) { } $$; ``` + +## Worker Management for UDFs + +In Databend Cloud, each UDF has an associated **Worker** that manages its execution environment in the sandbox. After creating a UDF, you may need to manage its worker for optimal performance and resource utilization. + +### Creating a Worker for Your UDF + +```sql +-- Create a worker for your UDF (worker name should match UDF name) +CREATE WORKER calculate_age_js WITH + size='small', + auto_suspend='300', + auto_resume='true'; +``` + +### Managing Worker Resources + +```sql +-- View all workers +SHOW WORKERS; + +-- Adjust worker settings +ALTER WORKER calculate_age_js SET size='medium', auto_suspend='600'; + +-- Add tags for organization +ALTER WORKER calculate_age_js SET TAG + environment='production', + team='analytics', + purpose='age-calculation'; +``` + +### Worker Lifecycle + +```sql +-- Suspend worker when not in use +ALTER WORKER calculate_age_js SUSPEND; + +-- Resume worker when needed +ALTER WORKER calculate_age_js RESUME; + +-- Remove worker when UDF is no longer needed +DROP WORKER calculate_age_js; +``` + +### Environment Variables + +For security reasons, environment variables for UDFs are managed separately in the cloud console. After creating a UDF and its worker, configure any required environment variables through the Databend Cloud interface. + +For more information, see [Worker Management](../20-worker/index.md). +``` diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/_category_.json b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/_category_.json new file mode 100644 index 0000000000..364daa8bd6 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Worker", + "position": 20, + "link": { + "type": "generated-index", + "description": "Worker management commands for UDF execution environments in Databend Cloud sandbox." + } +} \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/alter-worker.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/alter-worker.md new file mode 100644 index 0000000000..94b94be1c1 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/alter-worker.md @@ -0,0 +1,103 @@ +--- +title: ALTER WORKER +sidebar_position: 3 +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Modifies the settings, tags, or state of an existing worker. + +## Syntax + +```sql +-- Modify worker options +ALTER WORKER SET = '' [, = '' ...] +ALTER WORKER UNSET [, ...] + +-- Modify worker tags +ALTER WORKER SET TAG = '' [, = '' ...] +ALTER WORKER UNSET TAG [, ...] + +-- Change worker state +ALTER WORKER SUSPEND +ALTER WORKER RESUME +``` + +| Parameter | Description | +| ------------ | --------------------------------------------------------------------------- | +| worker_name | The name of the worker to modify | +| option_name | One of: `size`, `auto_suspend`, `auto_resume`, `max_cluster_count`, `min_cluster_count` | +| value | The new value for the option (as a string) | +| tag_name | The name of the tag to set or unset | +| tag_value | The value for the tag | + +## Options + +The same options available in `CREATE WORKER` can be modified using `ALTER WORKER`: + +| Option | Description | +| --------------------- | --------------------------------------------------------------------------- | +| `size` | Compute size of the worker (e.g., 'small', 'medium') | +| `auto_suspend` | Idle timeout before automatic suspend (seconds) | +| `auto_resume` | Whether auto-resume is enabled ('true' or 'false') | +| `max_cluster_count` | Upper bound for auto-scaling clusters | +| `min_cluster_count` | Lower bound for auto-scaling clusters | + +## Examples + +### Modify Worker Options + +Change the size and auto-suspend settings of a worker: + +```sql +ALTER WORKER read_env SET size='medium', auto_suspend='600'; +``` + +Reset specific options to their default values: + +```sql +ALTER WORKER read_env UNSET size, auto_suspend; +``` + +### Manage Worker Tags + +Add or update tags on a worker: + +```sql +ALTER WORKER read_env SET TAG purpose='sandbox', owner='ci'; +``` + +Remove tags from a worker: + +```sql +ALTER WORKER read_env UNSET TAG purpose, owner; +``` + +### Control Worker State + +Suspend a worker (stop its execution environment): + +```sql +ALTER WORKER read_env SUSPEND; +``` + +Resume a suspended worker: + +```sql +ALTER WORKER read_env RESUME; +``` + +## Notes + +1. **Atomic Operations**: Multiple options can be modified in a single `ALTER WORKER` statement. +2. **State Changes**: `SUSPEND` and `RESUME` are mutually exclusive with option modifications. +3. **Tag Management**: Tags are useful for categorizing and organizing workers. They can be used for cost allocation, environment identification, or team ownership. +4. **Validation**: Option values are validated according to the same rules as `CREATE WORKER`. + +## Related Topics + +- [CREATE WORKER](create-worker.md) - Create a new worker +- [SHOW WORKERS](show-workers.md) - List workers and their current settings +- [DROP WORKER](drop-worker.md) - Remove a worker \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/create-worker.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/create-worker.md new file mode 100644 index 0000000000..6cab380740 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/create-worker.md @@ -0,0 +1,75 @@ +--- +title: CREATE WORKER +sidebar_position: 1 +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Creates a new worker for UDF execution in the sandbox environment. + +## Syntax + +```sql +CREATE WORKER [ IF NOT EXISTS ] + [ WITH size = ''] + [ WITH auto_suspend = ''] + [ WITH auto_resume = ''] + [ WITH max_cluster_count = ''] + [ WITH min_cluster_count = ''] +``` + +| Parameter | Description | +| --------------- | --------------------------------------------------------------------------------------------- | +| `IF NOT EXISTS` | Optional. If specified, the command succeeds without changes if the worker already exists. | +| worker_name | The name of the worker to create. Corresponds to a UDF name. | + +## Options + +| Option | Type / Values | Default | Description | +| --------------------- | -------------------------------------- | ------------- | --------------------------------------------------------------------------- | +| `size` | String (e.g., 'small', 'medium') | Platform default | Controls the compute size of the worker | +| `auto_suspend` | String (seconds) | Platform default | Idle timeout before automatic suspend | +| `auto_resume` | String ('true' or 'false') | Platform default | Controls whether incoming requests wake the worker automatically | +| `max_cluster_count` | String (count) | Platform default | Upper bound for auto-scaling clusters | +| `min_cluster_count` | String (count) | Platform default | Lower bound for auto-scaling clusters | + +- Options are specified as key-value pairs using the `WITH` keyword +- All option values are passed as strings and must be enclosed in single quotes +- Options may appear in any order +- Option names are case-insensitive but shown here in lowercase for consistency + +## Examples + +Create a basic worker for a UDF named `read_env`: + +```sql +CREATE WORKER read_env; +``` + +Create a worker with `IF NOT EXISTS` to avoid errors if it already exists: + +```sql +CREATE WORKER IF NOT EXISTS read_env; +``` + +Create a worker with custom configuration: + +```sql +CREATE WORKER read_env WITH size='small', auto_suspend='300', auto_resume='true', max_cluster_count='3', min_cluster_count='1'; +``` + +## Notes + +1. **UDF Association**: Each worker corresponds to a single UDF. The worker name should match the UDF name. +2. **Environment Variables**: Environment variables for UDFs are managed separately in the cloud console for security reasons. +3. **Resource Management**: Workers manage the execution environment and resources for their associated UDFs. +4. **Cloud Integration**: Workers are integrated with Databend Cloud's control plane for lifecycle management. + +## Related Topics + +- [ALTER WORKER](alter-worker.md) - Modify worker settings +- [SHOW WORKERS](show-workers.md) - List available workers +- [DROP WORKER](drop-worker.md) - Remove a worker +- [User-Defined Functions](../10-udf/index.md) - Learn about UDFs in Databend \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/drop-worker.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/drop-worker.md new file mode 100644 index 0000000000..3009c55275 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/drop-worker.md @@ -0,0 +1,61 @@ +--- +title: DROP WORKER +sidebar_position: 4 +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Removes a worker from the system. + +## Syntax + +```sql +DROP WORKER [ IF EXISTS ] +``` + +| Parameter | Description | +| --------------- | --------------------------------------------------------------------------------------------- | +| `IF EXISTS` | Optional. If specified, the command succeeds without errors if the worker does not exist. | +| worker_name | The name of the worker to remove. | + +## Examples + +Remove a worker: + +```sql +DROP WORKER read_env; +``` + +Remove a worker only if it exists (avoids errors if the worker doesn't exist): + +```sql +DROP WORKER IF EXISTS read_env; +``` + +## Behavior + +1. **Resource Cleanup**: When a worker is dropped, all associated resources are released. +2. **UDF Association**: Dropping a worker does not automatically drop the associated UDF. The UDF can still exist but will not have an execution environment. +3. **Irreversible Operation**: Dropping a worker cannot be undone. The worker must be recreated if needed. +4. **Dependencies**: Ensure no active executions are using the worker before dropping it. + +## Error Conditions + +- `UnknownWorker`: If the worker does not exist and `IF EXISTS` is not specified. +- `WorkerInUse`: If the worker is currently executing UDFs or has pending operations. + +## Notes + +1. **Safety First**: Use `IF EXISTS` to make your scripts idempotent and avoid unnecessary errors. +2. **Check State**: Consider checking the worker's state with `SHOW WORKERS` before dropping it. +3. **Cleanup Order**: If you're cleaning up a UDF and its worker, drop the worker first, then the UDF if desired. +4. **Cloud Integration**: Worker deletion is coordinated with Databend Cloud's control plane to ensure proper resource cleanup. + +## Related Topics + +- [CREATE WORKER](create-worker.md) - Create a new worker +- [SHOW WORKERS](show-workers.md) - List available workers +- [ALTER WORKER](alter-worker.md) - Modify worker settings +- [User-Defined Functions](../10-udf/index.md) - Learn about UDFs in Databend \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/examples.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/examples.md new file mode 100644 index 0000000000..8547eac108 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/examples.md @@ -0,0 +1,283 @@ +--- +title: Worker Examples +sidebar_position: 5 +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +This page provides comprehensive examples of using WORKER commands to manage UDF execution environments in Databend Cloud. + +## Basic Worker Lifecycle + +### 1. Create a Worker + +Create a basic worker for a UDF named `read_env`: + +```sql +CREATE WORKER read_env; +``` + +Create a worker with `IF NOT EXISTS` to avoid errors: + +```sql +CREATE WORKER IF NOT EXISTS read_env; +``` + +Create a worker with custom configuration: + +```sql +CREATE WORKER read_env WITH + size='small', + auto_suspend='300', + auto_resume='true', + max_cluster_count='3', + min_cluster_count='1'; +``` + +### 2. List Workers + +View all workers in the current tenant: + +```sql +SHOW WORKERS; +``` + +### 3. Modify Worker Settings + +Change worker size and auto-suspend settings: + +```sql +ALTER WORKER read_env SET size='medium', auto_suspend='600'; +``` + +Reset specific options to defaults: + +```sql +ALTER WORKER read_env UNSET size, auto_suspend; +``` + +### 4. Manage Worker Tags + +Add tags to categorize workers: + +```sql +ALTER WORKER read_env SET TAG purpose='sandbox', owner='ci'; +``` + +Remove tags when no longer needed: + +```sql +ALTER WORKER read_env UNSET TAG purpose, owner; +``` + +### 5. Control Worker State + +Suspend a worker (stop its execution environment): + +```sql +ALTER WORKER read_env SUSPEND; +``` + +Resume a suspended worker: + +```sql +ALTER WORKER read_env RESUME; +``` + +### 6. Remove a Worker + +Remove a worker when no longer needed: + +```sql +DROP WORKER read_env; +``` + +Safely remove a worker (no error if it doesn't exist): + +```sql +DROP WORKER IF EXISTS read_env; +``` + +## Advanced Examples + +### Worker for Different Environments + +Create workers with environment-specific configurations: + +```sql +-- Development worker +CREATE WORKER dev_processor WITH + size='small', + auto_suspend='60', + auto_resume='true', + max_cluster_count='1', + min_cluster_count='1'; + +-- Production worker +CREATE WORKER prod_processor WITH + size='large', + auto_suspend='1800', + auto_resume='true', + max_cluster_count='5', + min_cluster_count='2'; +``` + +### Worker with Comprehensive Tagging + +Create a worker with detailed tags for organization: + +```sql +CREATE WORKER data_processor WITH + size='medium', + auto_suspend='900', + auto_resume='true', + max_cluster_count='3', + min_cluster_count='1' + TAG ( + environment='production', + team='data-engineering', + project='etl-pipeline', + cost_center='analytics', + created_by='ci-system' + ); +``` + +### Dynamic Worker Management + +Script to ensure a worker exists with specific configuration: + +```sql +-- Create worker if it doesn't exist +CREATE WORKER IF NOT EXISTS my_worker WITH + size='small', + auto_suspend='300'; + +-- Update tags +ALTER WORKER my_worker SET TAG + environment='staging', + last_updated=CAST(CURRENT_TIMESTAMP() AS STRING); + +-- Show current configuration +SHOW WORKERS; +``` + +## Best Practices + +### 1. Naming Conventions + +- Use descriptive names that indicate the UDF's purpose +- Include environment suffix (e.g., `_dev`, `_prod`, `_staging`) +- Consider team/project prefixes for multi-team environments + +### 2. Resource Sizing + +- Start with `size='small'` for development and testing +- Use `auto_suspend` to save costs for infrequently used workers +- Set appropriate `min_cluster_count` based on expected load + +### 3. Tag Strategy + +- Use tags for cost allocation and resource tracking +- Include environment, team, and project information +- Add creation date and owner for audit purposes + +### 4. Lifecycle Management + +- Use `IF NOT EXISTS` and `IF EXISTS` for idempotent scripts +- Monitor worker usage with `SHOW WORKERS` +- Clean up unused workers to reduce costs + +## Common Use Cases + +### 1. UDF Development + +```sql +-- Create a worker for UDF development +CREATE WORKER dev_transform WITH + size='small', + auto_suspend='60', + TAG (environment='development', purpose='testing'); + +-- After UDF is developed and tested +ALTER WORKER dev_transform SET + size='medium', + auto_suspend='300', + TAG purpose='production-ready'; +``` + +### 2. Batch Processing + +```sql +-- Worker for nightly batch jobs +CREATE WORKER nightly_etl WITH + size='large', + auto_suspend='3600', -- Suspend after 1 hour of inactivity + auto_resume='false', -- Don't auto-resume (manual control) + TAG ( + schedule='nightly', + job_type='etl', + criticality='high' + ); +``` + +### 3. Multi-tenant Environments + +```sql +-- Workers for different teams +CREATE WORKER team_a_processor WITH + size='medium', + TAG (team='team-a', billing_code='TA-2024'); + +CREATE WORKER team_b_processor WITH + size='small', + TAG (team='team-b', billing_code='TB-2024'); +``` + +## Troubleshooting + +### Worker Not Starting + +If a worker doesn't start as expected: + +1. Check if the UDF exists and is properly configured +2. Verify environment variables are set in the cloud console +3. Ensure the worker is not suspended: + +```sql +-- Check worker state +SHOW WORKERS; + +-- Resume if suspended +ALTER WORKER my_worker RESUME; +``` + +### Permission Issues + +Ensure you have the necessary privileges: + +```sql +-- Check your privileges +SHOW GRANTS; +``` + +### Resource Constraints + +If experiencing performance issues: + +```sql +-- Increase worker size +ALTER WORKER my_worker SET size='large'; + +-- Adjust cluster counts +ALTER WORKER my_worker SET + max_cluster_count='5', + min_cluster_count='2'; +``` + +## Related Topics + +- [User-Defined Functions (UDFs)](../10-udf/index.md) - Learn about creating and using UDFs +- [Warehouse Management](../19-warehouse/index.md) - Manage compute resources for query execution +- [Workload Groups](../20-workload-group/index.md) - Control resource allocation and priorities \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/index.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/index.md new file mode 100644 index 0000000000..28a20299e4 --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/index.md @@ -0,0 +1,60 @@ +--- +title: Worker +sidebar_position: 0 +--- + +Worker-related SQL commands for managing sandbox UDF execution environments in Databend Cloud. + +## Introduction + +Workers are execution environments for User-Defined Functions (UDFs) in Databend Cloud's sandbox environment. Each worker corresponds to a single UDF, and the cloud starts the corresponding worker based on the function name. The Worker management interface provides full lifecycle control over these execution environments. + +## General Rules + +- **Worker naming**: Follows standard identifier naming conventions +- **Strings and identifiers**: Bare identifiers may omit quotes when they contain no spaces; otherwise enclose with single quotes +- **Numeric parameters**: Accept integers or string representations +- **Boolean parameters**: Accept `'true'`/`'false'` string values +- **Options**: Specified using `WITH` keyword followed by key-value pairs + +## Worker Management + +Tags are key-value pairs that help categorize and organize workers, similar to warehouse tags. They are commonly used for: + +- **Environment identification**: Mark workers as dev, staging, or production +- **Purpose tracking**: Identify the purpose of the worker (e.g., sandbox, testing) +- **Ownership**: Identify which team or user owns the worker +- **Custom metadata**: Add any arbitrary metadata for organizational purposes + +Tag keys and values are arbitrary strings. Tags can be: + +- Added at worker creation time using options +- Updated or added later using `ALTER WORKER ... SET TAG key = 'value'` +- Removed using `ALTER WORKER ... UNSET TAG key` + +## Supported Statements + +| Statement | Purpose | Notes | +| ----------------- | ---------------------------- | ---------------------------------------------------------- | +| `CREATE WORKER` | Create a worker | Supports `IF NOT EXISTS` and option list | +| `ALTER WORKER` | Modify worker settings | Supports `SET`, `UNSET`, `SET TAG`, `UNSET TAG`, `SUSPEND`, `RESUME` | +| `SHOW WORKERS` | List workers | Shows all available workers | +| `DROP WORKER` | Delete a worker | Optional `IF EXISTS` | + +## Worker Management + +| Command | Description | +| ----------------------------------- | ------------------------------------------------- | +| [CREATE WORKER](create-worker.md) | Creates a new worker for UDF execution | +| [SHOW WORKERS](show-workers.md) | Lists all workers | +| [ALTER WORKER](alter-worker.md) | Modifies worker settings and state | +| [DROP WORKER](drop-worker.md) | Removes a worker | +| [Examples](examples.md) | Comprehensive usage examples and best practices | + +:::note +A worker represents an execution environment for a specific UDF in Databend Cloud's sandbox. Each UDF has a corresponding worker that manages its runtime environment and resources. +::: + +:::tip +Environment variables for UDFs are managed by the cloud for security reasons. After creating a UDF, users need to configure environment variables in the cloud console. +::: \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/show-workers.md b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/show-workers.md new file mode 100644 index 0000000000..9d120c490b --- /dev/null +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/20-worker/show-workers.md @@ -0,0 +1,63 @@ +--- +title: SHOW WORKERS +sidebar_position: 2 +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Lists all workers available in the current tenant. + +## Syntax + +```sql +SHOW WORKERS +``` + +## Output + +The command returns a table with the following columns: + +| Column Name | Data Type | Description | +| --------------- | --------- | ------------------------------------------------ | +| name | String | The name of the worker | +| size | String | The compute size of the worker | +| auto_suspend | String | Auto-suspend timeout in seconds | +| auto_resume | String | Whether auto-resume is enabled ('true'/'false') | +| max_cluster_count | String | Maximum cluster count for auto-scaling | +| min_cluster_count | String | Minimum cluster count for auto-scaling | +| tags | Map | Key-value tags associated with the worker | +| created_at | Timestamp | When the worker was created | +| updated_at | Timestamp | When the worker was last updated | +| state | String | Current state of the worker (e.g., ACTIVE, SUSPENDED) | + +## Examples + +List all workers: + +```sql +SHOW WORKERS; +``` + +Sample output: + +``` +name | size | auto_suspend | auto_resume | max_cluster_count | min_cluster_count | tags | created_at | updated_at | state +-----------+-------+--------------+-------------+-------------------+-------------------+--------------------------------+---------------------+---------------------+-------- +read_env | small | 300 | true | 3 | 1 | {purpose: sandbox, owner: ci} | 2024-01-15 10:30:00 | 2024-01-15 10:30:00 | ACTIVE +process_csv| medium| 600 | true | 5 | 2 | {environment: production} | 2024-01-14 09:15:00 | 2024-01-15 08:45:00 | ACTIVE +``` + +## Notes + +1. **Tenant Scope**: The command shows workers for the current tenant only. +2. **State Information**: The state column indicates whether the worker is active, suspended, or in another state. +3. **Tag Display**: Tags are displayed as a map of key-value pairs. +4. **Time Zones**: Timestamps are displayed in UTC. + +## Related Topics + +- [CREATE WORKER](create-worker.md) - Create a new worker +- [ALTER WORKER](alter-worker.md) - Modify worker settings +- [DROP WORKER](drop-worker.md) - Remove a worker \ No newline at end of file diff --git a/docs/en/sql-reference/10-sql-commands/00-ddl/index.md b/docs/en/sql-reference/10-sql-commands/00-ddl/index.md index 2196c93e59..187a17a52d 100644 --- a/docs/en/sql-reference/10-sql-commands/00-ddl/index.md +++ b/docs/en/sql-reference/10-sql-commands/00-ddl/index.md @@ -56,6 +56,7 @@ These topics provide reference information for the DDL (Data Definition Language | Component | Description | |-----------|-------------| | **[Warehouse](19-warehouse/index.md)** | Manage compute resources for query execution | +| **[Worker](20-worker/index.md)** | Manage UDF execution environments in sandbox | | **[Workload Group](20-workload-group/index.md)** | Control resource allocation and priorities | | **[Transaction](14-transaction/index.md)** | Manage database transactions | | **[Variable](15-variable/index.md)** | Set and use session/global variables | diff --git a/docs/en/sql-reference/20-sql-functions/08-window-functions/range-between.md b/docs/en/sql-reference/20-sql-functions/08-window-functions/range-between.md index aadf550dcf..8cb9326907 100644 --- a/docs/en/sql-reference/20-sql-functions/08-window-functions/range-between.md +++ b/docs/en/sql-reference/20-sql-functions/08-window-functions/range-between.md @@ -194,7 +194,7 @@ SELECT sale_date, amount, ORDER BY sale_date RANGE BETWEEN INTERVAL '7' DAY PRECEDING AND CURRENT ROW ) AS avg_7day -FROM sales +FROM sales_duplicates ORDER BY sale_date; ``` @@ -266,4 +266,4 @@ ORDER BY sale_date; - [Window Functions Overview](index.md) - [ROWS BETWEEN](rows-between.md) - Row-based window frames - [Aggregate Functions](../07-aggregate-functions/index.md) - Functions that can use window frames -- [Date and Time Functions](../05-datetime-functions/index.md) - Useful with RANGE intervals \ No newline at end of file +- [Date and Time Functions](../05-datetime-functions/index.md) - Useful with RANGE intervals