⌘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 10 for addresses (0.001 sec.)
SELECT Clause 12120
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 ... S root FROM tbl; Use prefix aliases: SELECT res: col1 + col2, root: sqrt(col1) FROM tbl; Select all unique cities from the addresses table: SELECT DISTINCT city FROM addresses; Return the total number of rows in the addresses table: SELECT count(*) FROM a ... ddresses; Select all columns except the city column from the addresses table: SELECT * EXCLUDE (city) FROM addresses; Select all columns from the addresses table, but replace city with lower(ci ... ty) : SELECT * REPLACE (lower(city) AS city) FROM addresses; Select all columns matching the given regular expression from the table: SELECT COLUMNS('number\d+') FROM addresses; Comp ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/select.html
LIMIT and OFFSET Clauses 11942
LIMIT is an output modifier. Logically it is applied at the very end of the query. The LIMIT clause restricts the amount of rows fetched. The OFFSET clause indicates at which position to start reading the values, i.e., the first OFFSET valu ... ful, however, for example when you want to inspect a quick snapshot of the data. Examples Select the first 5 rows from the addresses table: SELECT * FROM addresses LIMIT 5; Select the 5 rows from the addresses table, starting at position 5 (i.e., ignoring ... the first 5 rows): SELECT * FROM addresses LIMIT 5 OFFSET 5; Select the top 5 cities with the highest population: SELECT city, count(*) AS population FROM addresses ... GROUP BY city ORDER BY population DESC LIMIT 5; Select 10% of the rows from the addresses table: SELECT * FROM addresses LIMIT 10%; FETCH FIRST New The SQL-standard FETCH FIRST syntax was introduced in DuckDB 2.0 ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/limit.html
ORDER BY Clause 9779
ORDER BY is an output modifier. Logically it is applied near the very end of the query (just prior to LIMIT or OFFSET , if present). The ORDER BY clause sorts the rows on the sorting criteria in either ascending or descending order. In addi ... information on collations, see the Collation page . Examples All examples use this example table: CREATE OR REPLACE TABLE addresses AS SELECT '123 Quack Blvd' AS address, 'DuckTown' AS city, '11111' AS zip UNION ALL SELECT '111 Duck Duck Goose Ln', 'Duck ... Duck Duck Goose Ln', 'Duck Town', '11111' UNION ALL SELECT '111 Duck Duck Goose Ln', 'Duck Town', '11111-0001'; Select the addresses, ordered by city name using the default NULL order and default order: SELECT * FROM addresses ORDER BY city; Select the ad ... dresses, ordered by city name in descending order with nulls at the end: SELECT * FROM addresses ORDER BY city DESC NULLS LAST; Order by city and then by zip code, both using the default orderings: SELECT * FROM address ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/orderby.html
SAMPLE Clause 9242
The SAMPLE clause allows you to run the query on a sample from the base table. This can significantly speed up processing of queries, at the expense of accuracy in the result. Samples can also be used to quickly see a snapshot of the data w ... efore the WHERE clause or any aggregates). See the SAMPLE page for more information. Examples Select a sample of 1% of the addresses table using default (system) sampling: SELECT * FROM addresses USING SAMPLE 1%; Select a sample of 1% of the addresses tab ... le using bernoulli sampling: SELECT * FROM addresses USING SAMPLE 1% (bernoulli); Select a sample of 10 rows from the subquery: SELECT * FROM (SELECT * FROM addresses) USING S ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/sample.html
GROUP BY Clause 8813
The GROUP BY clause specifies which grouping columns should be used to perform any aggregations in the SELECT clause. If the GROUP BY clause is specified, the query is always an aggregate query, even if no aggregations are present in the SE ... 'c']), (['b'])) t(tags) GROUP BY unnest(tags) ORDER BY tag; tag n a 1 b 3 c 1 Examples Count the number of entries in the addresses table that belong to each different city: SELECT city, count(*) FROM addresses GROUP BY city; Compute the average income p ... er city per street_name : SELECT city, street_name, avg(income) FROM addresses GROUP BY city, street_name; GROUP BY ALL Examples Group by city and street_name to remove any duplicate values: SELECT cit ... y, street_name FROM addresses GROUP BY ALL; Compute the average income per city per street_name. Since income is wrapped in an aggregate function, do no ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/groupby.html
HAVING Clause 8545
The HAVING clause can be used after the GROUP BY clause to provide filter criteria after the grouping has been completed. In terms of syntax the HAVING clause is identical to the WHERE clause, but while the WHERE clause occurs before the gr ... ouping, the HAVING clause occurs after the grouping. Examples Count the number of entries in the addresses table that belong to each different city , filtering out cities with a count below 50: SELECT city, count(*) FROM addresse ... ltering out cities with an average income bigger than twice the median income : SELECT city, street_name, avg(income) FROM addresses GROUP BY city, street_name HAVING avg(income) > 2 * median(income); Syntax ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/having.html
GROUPING SETS 7311
GROUPING SETS , ROLLUP and CUBE can be used in the GROUP BY clause to perform a grouping over multiple dimensions within the same query. Note that this syntax is not compatible with GROUP BY ALL . Examples Compute the average income along t ... -- the syntax () denotes the empty set (i.e., computing an ungrouped aggregate) SELECT city, street_name, avg(income) FROM addresses GROUP BY GROUPING SETS ((city, street_name), (city), (street_name), ()); Compute the average income along the same dimensi ... ons: SELECT city, street_name, avg(income) FROM addresses GROUP BY CUBE (city, street_name); Compute the average income along the dimensions (city, street_name) , (city) and () : S ... ELECT city, street_name, avg(income) FROM addresses GROUP BY ROLLUP (city, street_name); Description GROUPING SETS performs the same aggregate across different GROUP BY claus ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/grouping_sets.html
SELECT Statement 7222
The SELECT statement retrieves rows from the database. Examples Select all columns from the table tbl : SELECT * FROM tbl; Select the rows from tbl : SELECT j FROM tbl WHERE i = 3; Perform an aggregate grouped by the column i : SELECT i, su ... ndexes to select the first and third column from the table tbl : SELECT #1, #3 FROM tbl; Select all unique cities from the addresses table: SELECT DISTINCT city FROM addresses; Return a STRUCT by using a row variable: SELECT d FROM (SELECT 1 AS a, 2 AS b) ...
https://man.mtool.work/duckdb/2.0/sql/statements/select.html
inet Extension 7186
The inet extension defines the INET data type for storing IPv4 and IPv6 Internet addresses. It supports the CIDR notation for subnet masks (e.g., 198.51.100.0/22 , 2001:db8:3c4d::/48 ). Installing and Loading The inet extension will be tran ... a2f:1a2b Operations on INET Values INET values can be compared naturally, and IPv4 will sort before IPv6. Additionally, IP addresses can be modified by adding or subtracting integers. CREATE TABLE tbl (cidr INET); INSERT INTO tbl VALUES ('127.0.0.1'::INET ...
https://man.mtool.work/duckdb/2.0/core_extensions/inet.html
Create Synthetic Data 7133
DuckDB lets you quickly generate synthetic datasets by combining a few building blocks: functions and clauses that generate rows , functions that generate values to fill those rows, and extensions that generate whole benchmark datasets. Thi ... CE id_seq START 100; SELECT nextval('id_seq') AS id FROM range(3); Generating Text with Faker For realistic-looking names, addresses and other text, you can call the Faker Python package through the Python function API : import duckdb from duckdb.sqltypes ... ity Extensions The fakeit community extension provides table functions that generate fake data (such as names, emails, and addresses) directly in SQL, similar to the Faker Python package. ...
https://man.mtool.work/duckdb/2.0/guides/snippets/create_synthetic_data.html
PREV 1 NEXT
DuckDB 2.0 Documentation / man.mtool.work