⌘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 80 for expression (0.007 sec.)
Python Client API 12561
Connection class duckdb. Appender Bases: object append_row ( self , * args ) → None Buffer one row, one value per column, each converted as an executemany parameter would be append_rows ( self , rows : object ) → None Buffer each row of an ... al API page . alias Get the name of the current alias. Detailed examples can be found at Relational API page . any_value ( expression : str , groups : str = '' , window_spec : str = '' , projected_columns : str = '' ) → DuckDBPyRelation Returns the first n ... on-null value from a given expression. Detailed examples can be found at Relational API page . apply ( function_name : str , function_aggr : str , group_expr : ... rrow_reader(). We recommend using to_arrow_reader() instead. Detailed examples can be found at Relational API page . avg ( expression : str , groups : str = '' , window_spec : str = '' , projected_columns : str = '' ) → DuckDBPyRelation Computes the averag ...
https://man.mtool.work/duckdb/2.0/clients/python/reference/
Relational API 11232
The Relational API builds a query one step at a time from Python. A relation, a DuckDBPyRelation , is a piece of SQL text: the methods of the Transformation and Functions sections return a new relation whose text extends the one they were c ... f one row, several tuples for several rows or the values of one row as separate arguments. A value is a Python value or an Expression. Example import duckdb duckdb_conn = duckdb.connect() rel = duckdb_conn.values([1, 'a']) rel.show() Result ┌───────┬────── ... n the view named virtual_table_name that refers to the relation object. The name is this query's own: it is a common table expression over the relation, and a catalog entry for the length of the call, so a table function or a query that defines the name it ... inst it. Nothing of it is left afterwards. A statement that does not only read, which includes a SELECT whose common table expression writes, runs at the call and the relation holds what it returned. Parameters virtual_table_name : str The name under which ...
https://man.mtool.work/duckdb/2.0/clients/python/relational_api.html
Expression API 10739
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 ... rice_column = "price" rel = duckdb.from_df(sales) print(rel.filter(col(price_column) > 30).fetchall()) [('hammer', 42)] An expression is passed to a method of a relation , such as select , filter , aggregate or sort . str() of an expression returns its SQL ... in parentheses: print((col("a") > 1) & col("b")) (("a" > 1) AND "b") The duckdb module has a short helper for each kind of expression, and this page uses them throughout. The constructors of the earlier expression API still work and build the same expressi ... ons, but new code should use the helpers: Helper Older constructor col(name) ColumnExpression(name) lit(value) ConstantExpression(value) when(condition).then(value) CaseExpression(condition, value) fn(name, *args) Fu ...
https://man.mtool.work/duckdb/2.0/clients/python/expression.html
Star Expression 10328
Syntax The * expression can be used in a SELECT statement to select all columns that are projected in the FROM clause. SELECT * FROM tbl; TABLE.* and STRUCT.* The * expression can be prepended by a table name to select only columns from tha ... t table. SELECT tbl.* FROM tbl JOIN other_tbl USING (id); Similarly, the * expression can also be used to retrieve all keys from a struct as separate columns. This is particularly useful when a prior operatio ... LECT {'x': 1, 'y': 2, 'z': 3} AS st); x y z 1 2 3 EXCLUDE Clause EXCLUDE allows you to exclude specific columns from the * expression. SELECT * EXCLUDE (col) FROM tbl; New As of DuckDB 2.0, EXCEPT is accepted as a synonym for EXCLUDE , matching the SQL-sta ... me query. sql SELECT * EXCEPT (col) FROM tbl; REPLACE Clause REPLACE allows you to replace specific columns by alternative expressions. SELECT * REPLACE (col1 / 1_000 AS col1, col2 / 1_000 AS col2) FROM tbl; RENAME Clause RENAME allows you to replace speci ...
https://man.mtool.work/duckdb/2.0/sql/expressions/star.html
CREATE MACRO Statement 10259
The CREATE MACRO statement defines a named, callable SQL expression as a database schema object. Macros may declare parameters, which can be referenced by its expression. Once a macro is created, it may be called by referencing its name and ... by passing values to its parameters; this causes its expression to be evaluated, yielding a value. Depending on the macro type, the value may be scalar, or a TABLE value. The CREATE FUNC ... for creating a macro is: CREATE [OR REPLACE] [TEMPORARY] MACRO [IF NOT EXISTS] ⟨identifier⟩( [⟨parameters⟩] ) AS [TABLE] ⟨expression⟩; The identifier consists of the macro's name, which can be any valid SQL identifier. A macro may be explicitly qualified ... ers , then they must be declared within the parentheses. The AS keyword appears after the right parenthesis but before the expression The TABLE keyword may appear right after the AS keyword, directly before the expression, indicating the macro is a table m ...
https://man.mtool.work/duckdb/2.0/sql/statements/create_macro.html
CASE Expression 9437
The CASE expression performs a switch based on a condition. The basic form is identical to the ternary condition used in many programming languages ( CASE WHEN cond THEN a ELSE b END is equivalent to cond ? a : b ). With a single condition ... 0 2 0 3 1 This is equivalent to: SELECT i, IF(i > 2, 1, 0) AS test FROM integers; The WHEN cond THEN expr part of the CASE expression can be chained, whenever any of the conditions returns true for a single tuple, the corresponding expression is evaluated ... E WHEN i = 1 THEN 10 WHEN i = 2 THEN 20 ELSE 0 END AS test FROM integers; i test 1 10 2 20 3 0 The ELSE clause of the CASE expression is optional. If no ELSE clause is provided and none of the conditions match, the CASE expression will return NULL . CREATE ... CASE WHEN i = 1 THEN 10 END AS test FROM integers; i test 1 10 2 NULL 3 NULL It is also possible to provide an individual expression after the CASE but before the WHEN . When this is done, the CASE expression is effectively transformed into a switch state ...
https://man.mtool.work/duckdb/2.0/sql/expressions/case.html
TRY Expression 9136
The TRY expression ensures that errors caused by the input rows in the child (scalar) expression result in NULL for those rows, instead of causing the query to throw an error. The TRY expression was inspired by the TRY_CAST expression . Exa ... mples The following calls return errors when invoked without the TRY expression. When they are wrapped into a TRY expression, they return NULL : Casting Without TRY SELECT 'abc'::INTEGER; Conversion Err ... ECT TRY('abc'::INTEGER); NULL Integer Division by Zero Without TRY SELECT 1 // 0; Invalid Input Error: Division by zero in expression (1 // 0). Use TRY(...) to return NULL for this expression, or SET error_on_division_by_zero=false to return NULL for all d ...
https://man.mtool.work/duckdb/2.0/sql/expressions/try.html
Pattern Matching 9068
There are four separate approaches to pattern matching provided by DuckDB: the traditional SQL LIKE operator , the more recent SIMILAR TO operator (added in SQL:1999), a GLOB operator , and POSIX-style regular expressions . LIKE The LIKE expression ... pression returns true if the string matches the supplied pattern. (As expected, the NOT LIKE expression returns false if LIKE returns true , and vice versa. An equivalent expression is NOT (string LIKE pattern) .) If pattern d ... r instead of a wildcard. See an example below. Additionally, the function like_escape has the same functionality as a LIKE expression with an ESCAPE clause, but using function syntax. See the Text Functions page for details. Search for strings with a then ... 'A%c' ILIKE 'a$%c' ESCAPE '$'; -- true There are also alternative characters that can be used as keywords in place of LIKE expressions. These enhance PostgreSQL compatibility. PostgreSQL-style LIKE -style ~~ LIKE !~~ NOT LIKE ~~* ILIKE !~~* NOT ILIKE SIMIL ...
https://man.mtool.work/duckdb/2.0/sql/functions/pattern_matching.html
Utility Functions 8615
Scalar Utility Functions The functions below are difficult to categorize into specific function types and are broadly useful. Name Description alias(column) Return the name of the column. can_cast_implicitly(source_value, target_value) Whet ... Synchronize WAL with file for (optional) database without interrupting transactions. coalesce(expr, ...) Return the first expression that evaluates to a non- NULL value. Accepts 1 or more parameters. Each expression can be a column, literal value, functio ... bb5e-222f4e14b687 . get_block_size(database) Returns the block size of the attached database with the given name. get_type(expression) Returns the data type of the result of the expression as a value of type TYPE . getenv(var) Returns the value of the envi ... an-readable byte size string (e.g., '16 KiB' ) into a UBIGINT number of bytes. Throws an error on invalid input. pg_typeof(expression) Returns the lower case name of the data type of the result of the expression. For PostgreSQL compatibility. query( query_ ...
https://man.mtool.work/duckdb/2.0/sql/functions/utility.html
Aggregate Functions 8588
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 ... arg . This function is affected by ordering . arg_max(arg, val) Finds the row with the maximum val and calculates the arg expression at that row. Rows where the value of the arg or val expression is NULL are ignored. This function is affected by ordering ... . arg_max(arg, val, n) The generalized case of arg_max for n values: returns a LIST containing the arg expressions for the top n rows ordered by val descending. This function is affected by ordering . arg_max_null(arg, val) Finds the ro ... w with the maximum val and calculates the arg expression at that row. Rows where the val expression evaluates to NULL are ignored. This function is affected by ordering . arg_max_ ...
https://man.mtool.work/duckdb/2.0/sql/functions/aggregates.html
PREV 1 2 3 4 5 6 7 8 NEXT
DuckDB 2.0 Documentation / man.mtool.work