⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k
DuckDB 2.0 ドキュメント 全文検索
per page, with , order by , clip by
Results of 1 - 10 of about 15 for sales (0.002 sec.)
UNPIVOT Statement 14751
The UNPIVOT statement allows multiple columns to be stacked into fewer columns. In the basic case, multiple columns are stacked into two columns: a NAME column (which contains the name of the source column) and a VALUE column (which contain ... ⟨number_of_rows⟩; Example Data All examples use the dataset produced by the queries below: CREATE OR REPLACE TABLE monthly_sales (empid INTEGER, dept TEXT, Jan INTEGER, Feb INTEGER, Mar INTEGER, Apr INTEGER, May INTEGER, Jun INTEGER); INSERT INTO mont ... hly_sales VALUES (1, 'electronics', 1, 2, 3, 4, 5, 6), (2, 'clothes', 10, 20, 30, 40, 50, 60), (3, 'cars', 100, 200, 300, 400, 500, ... 600); FROM monthly_sales; empid dept Jan Feb Mar Apr May Jun 1 electronics 1 2 3 4 5 6 2 clothes 10 20 30 40 50 60 3 cars 100 200 300 400 500 600 U ...
https://man.mtool.work/duckdb/2.0/sql/statements/unpivot.html
Pivot Internals 9892
PIVOT Pivoting is implemented as a combination of SQL query re-writing and a dedicated PhysicalPivot operator for higher performance. Each PIVOT is implemented as set of aggregations into lists and then the dedicated PhysicalPivot operator ... namically unpivoting, the COLUMNS expression is evaluated first to calculate the column list. For example: UNPIVOT monthly_sales ON jan, feb, mar, apr, may, jun INTO NAME month VALUE sales; is translated into: SELECT empid, dept, unnest(['jan', 'feb', ... 'mar', 'apr', 'may', 'jun']) AS month, unnest(["jan", "feb", "mar", "apr", "may", "jun"]) AS sales FROM monthly_sales; Note the single quotes to build a list of text strings to populate month , and the double quotes to pu ... ll the column values for use in sales . This produces the same result as the initial example: empid dept month sales 1 electronics jan 1 1 electronics feb 2 1 e ...
https://man.mtool.work/duckdb/2.0/internals/pivot.html
Writing to Iceberg 9143
The DuckDB iceberg extension supports writing to Iceberg tables when an Iceberg catalog is attached. Writing to a table read directly from storage with iceberg_scan is not supported: the catalog is required to commit the new table metadata. ... re exposed as schemas, which can be created and dropped with CREATE SCHEMA and DROP SCHEMA : CREATE SCHEMA iceberg_catalog.sales; USE iceberg_catalog.sales; Tables are created with the standard CREATE TABLE syntax. Iceberg table properties can be supp ... = 'value1', 'property2' = 'value2' ); Tables can also be created from the result of a query: CREATE TABLE iceberg_catalog.sales.events_copy AS FROM iceberg_catalog.sales.events; Table properties can also be inspected and modified after creation, see ... DELETE The UPDATE and DELETE statements are supported on both partitioned and unpartitioned tables: UPDATE iceberg_catalog.sales.events SET event_name = 'view' WHERE id = 1; DELETE FROM iceberg_catalog.sales.events WHERE event_time < TIMESTAMP '2026-0 ...
https://man.mtool.work/duckdb/2.0/core_extensions/iceberg/writing_to_iceberg.htm...
Enum Data Type 8882
Name Description ENUM Dictionary representing all possible string values of a column The enum type represents a dictionary data structure with all possible unique values of a column. For example, a column storing the days of the week can be ... tement will be deduplicated automatically, and NULL values will be ignored: CREATE TYPE region AS ENUM (SELECT region FROM sales_data); If you are importing data from a file, you can create an enum for a VARCHAR column before importing: CREATE TYPE re ... gion AS ENUM (SELECT region FROM 'sales_data.csv'); CREATE TABLE sales_data (amount INTEGER, region region); COPY sales_data FROM 'sales_data.csv'; Using Enums En ...
https://man.mtool.work/duckdb/2.0/sql/data_types/enum.html
Window Functions 8829
DuckDB supports window functions , which can use multiple rows to calculate a value for each row. Window functions are blocking operators , i.e., they require their entire input to be buffered, making them one of the most memory-intensive o ... d by major SQL database systems. Examples Generate a row_number column to enumerate rows: SELECT row_number() OVER () FROM sales; Tip If you only need a number for each row in a table, you can use the rowid pseudocolumn . Generate a row_number column ... to enumerate rows, ordered by time : SELECT row_number() OVER (ORDER BY time) FROM sales; Generate a row_number column to enumerate rows, ordered by time and partitioned by region : SELECT row_number() OVER (PAR ... TITION BY region ORDER BY time) FROM sales; Compute the difference between the current and the previous-by- time amount : SELECT amount - lag(amount) OVER (ORDER BY ...
https://man.mtool.work/duckdb/2.0/sql/functions/window_functions.html
Catalogs 8516
The iceberg extension supports attaching Iceberg REST Catalogs. Attaching a catalog is required for writing to Iceberg . Before attaching an Iceberg REST Catalog, you must install the iceberg extension by following the instructions located ... default ATTACH options, including CREATE SCHEMA , CREATE TABLE , INSERT , and DROP TABLE : CREATE SCHEMA seaweedfs_catalog.sales; CREATE TABLE seaweedfs_catalog.sales.orders (id BIGINT, region VARCHAR, amount DOUBLE); INSERT INTO seaweedfs_catalog.sal ... ers VALUES (1, 'NA', 12.5), (2, 'EU', 40.0), (3, 'APAC', 99.9); SELECT region, sum(amount) AS total FROM seaweedfs_catalog.sales.orders GROUP BY region ORDER BY total DESC; DROP TABLE seaweedfs_catalog.sales.orders; Google Cloud BigLake To attach to a ...
https://man.mtool.work/duckdb/2.0/core_extensions/iceberg/catalogs.html
Aggregate Functions 8202
Examples Produce a single row containing the sum of the amount column: SELECT sum(amount) FROM sales; Produce one row per unique region, containing the sum of amount for each group: SELECT region, sum(amount) FROM sales GROUP BY region; Ret ... urn only the regions that have a sum of amount higher than 100: SELECT region FROM sales GROUP BY region HAVING sum(amount) > 100; Return the number of unique values in the region column: SELECT count(DISTINCT r ... egion) FROM sales; Return two values, the total sum of amount and the sum of amount minus columns where the region is north using the FILTER ... clause : SELECT sum(amount), sum(amount) FILTER (region != 'north') FROM sales; Returns a list of all regions in order of the amount column: SELECT list(region ORDER BY amount DESC) FROM sales; Returns ...
https://man.mtool.work/duckdb/2.0/sql/functions/aggregates.html
Expression API 8028
The Expression class represents an instance of an expression . Why Would I Use the Expression API? Use expressions to build filters and computed columns in Python. They are useful when column names or conditions depend on your code. import ... duckdb import pandas as pd from duckdb import col sales = pd.DataFrame({"item": ["jeans", "hammer"], "price": [20, 42]}) price_column = "price" rel = duckdb.from_df(sales) print( ... e older SQLExpression(text) also checks that the text is one expression. Never build either from untrusted input. With the sales DataFrame from the top of the page: from duckdb import sql_expr rel = duckdb.from_df(sales) print(rel.select(sql_expr("pri ...
https://man.mtool.work/duckdb/2.0/clients/python/expression.html
Partitioned Writes 7872
Examples Write a table to a Hive partitioned dataset of Parquet files: COPY orders TO 'orders' (FORMAT parquet, PARTITION_BY (year, month)); Write a table to a Hive partitioned dataset of CSV files, allowing overwrites: COPY orders TO 'orde ... laces this with an expression over the PARTITION_BY columns that computes the output subdirectory for each partition: COPY sales TO 'sales' (FORMAT parquet, PARTITION_BY (region), PARTITION_PATH CASE WHEN region = 'eu' THEN 'europe' ELSE 'region=' || ...
https://man.mtool.work/duckdb/2.0/data/partitioning/partitioned_writes.html
SELECT Clause 7872
The SELECT clause specifies the list of columns that will be returned by the query. While it appears first in the clause, logically the expressions here are executed only at the end. The SELECT clause can contain arbitrary expressions that ... w Functions Generate a row_number column containing incremental identifiers for each row: SELECT row_number() OVER () FROM sales; Compute the difference between the current amount, and the previous amount, by order of time: SELECT amount - lag(amount) ... OVER (ORDER BY time) FROM sales; Window functions are special functions that allow the computation of values relative to other rows in a result. Window fu ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/select.html
PREV 1 2 NEXT
DuckDB 2.0 Documentation / man.mtool.work