Results of 1 - 10 of about 41 for integers (0.001 sec.)
- ALTER TABLE Statement 14299
- The ALTER TABLE statement changes the schema of an existing table in the catalog. Examples CREATE TABLE integers (i INTEGER, j INTEGER); Add a new column with name k to the table integers , it will be filled with the default value NULL : AL
...TER TABLE integers ADD COLUMN k INTEGER; Add a new column with name l to the table integers, it will be filled with the default value 10: ALT...ER TABLE integers ADD COLUMN l INTEGER DEFAULT 10; Drop the column k from the table integers: ALTER TABLE integers DROP k; Change the type o...f the column i to the type VARCHAR using a standard cast: ALTER TABLE integers ALTER i TYPE VARCHAR; Change the type of the column i to the type VARCHAR , using the specified expression to convert the... - https://man.mtool.work/duckdb/2.0/sql/statements/alter_table.html
- CASE Expression 13040
- 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
...this can be expressed with IF(cond, a, b) . CREATE OR REPLACE TABLE integers AS SELECT unnest([1, 2, 3]) AS i; SELECT i, CASE WHEN i > 2 THEN 1 ELSE 0 END AS test FROM integers; i test 1 0 2 0 3 1 Th...is 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 sin...gle tuple, the corresponding expression is evaluated and returned. CREATE OR REPLACE TABLE integers AS SELECT unnest([1, 2, 3]) AS i; SELECT i, CASE WHEN i = 1 THEN 10 WHEN i = 2 THEN 20 ELSE 0 END AS test FROM integers; i... - https://man.mtool.work/duckdb/2.0/sql/expressions/case.html
- Executing SQL in Python 10180
- SQL queries can be executed using the duckdb.sql function. import duckdb duckdb.sql("SELECT 42").show() By default this will create a relation object. The result can be converted to various formats using the result conversion functions. For
...After connecting, SQL queries can be executed using the sql command. con = duckdb.connect("file.db") con.sql("CREATE TABLE integers (i INTEGER)") con.sql("INSERT INTO integers VALUES (42)") con.sql("SELECT * FROM integers").show() A statement that change...ring using the execute method. Use ? for positional parameters, supplying the values as a list: con.execute("SELECT * FROM integers WHERE i = ?", [42]).fetchall() Named parameters use the $name syntax, with the values supplied as a dictionary: con.execut...e("SELECT * FROM integers WHERE i = $value", {"value": 42}).fetchall() con.sql and duckdb.sql take the values through their params keyword argument:... - https://man.mtool.work/duckdb/2.0/guides/python/execute_sql.html
- NULL Values 9729
- NULL values are special values that are used to represent missing data in SQL. Columns of any type can contain NULL values. Logically, a NULL value can be seen as “the value of this field is unknown”. A NULL value can be inserted to any fie
...ld that does not have the NOT NULL qualifier: CREATE TABLE integers (i INTEGER); INSERT INTO integers VALUES (NULL); NULL values have special semantics in many parts of the query as well as...LTER (WHERE x IS NOT NULL) . A different filter predicate does not remove NULL values from rows that pass it. CREATE TABLE integers (i INTEGER); INSERT INTO integers VALUES (1), (10), (NULL); SELECT min(i) FROM integers; 1 SELECT max(i) FROM integers; 10... - https://man.mtool.work/duckdb/2.0/sql/data_types/nulls.html
- Loops 9014
- Loops can be used in sqllogictests when it is required to execute the same query many times but with slight modifications in constant values. For example, suppose we want to fire off 100 queries that check for the presence of the values 0..
....100 in a table: # create the table 'integers' with values 0...100 statement ok CREATE TABLE integers AS SELECT * FROM range(0, 100, 1) t1(i); # verify individually tha...t all 100 values are there loop i 0 100 # execute the query, replacing the value query I SELECT count(*) FROM integers WHERE i = ${i}; ---- 1 # end the loop (note that multiple statements can be part of a loop) endloop Similarly, foreach can...the test cases. Instead, it is better to generate data using the built-in range and repeat functions. To create the table integers with the values [0, 1, ..., 98, 99] , run: CREATE TABLE integers AS SELECT * FROM range(0, 100, 1) t1(i); To create the ta... - https://man.mtool.work/duckdb/2.0/dev/sqllogictest/loops.html
- C++ API 8361
- Installation To use the DuckDB C++ API, download the libduckdb archive for your platform. The latest stable version of the DuckDB C++ API is 2.0.0. Warning DuckDB's C++ API is internal. It is not guaranteed to be stable and can change witho
...so it can be read repeatedly. To submit a query without blocking, use Submit() . // create a table con.Query("CREATE TABLE integers (i INTEGER, j INTEGER)"); // insert three rows into the table con.Query("INSERT INTO integers VALUES (3, 4), (5, 6), (7, N...ULL)"); auto result = con.Query("SELECT * FROM integers"); if (result->HasError()) { cerr << result->GetError() << endl; } else { cout << result->ToString() << endl; } Query will...available for any QueryResult instance which may aid in more explicit error handling. auto result = con.Query("INSERT INTO integers VALUES (1, 2)"); if (result->HasError()) { auto errorType = result->GetErrorType(); switch (errorType) { case duckdb::Exce... - https://man.mtool.work/duckdb/2.0/clients/cpp.html
- Boolean Type 8361
- Name Aliases Description BOOLEAN BOOL Logical Boolean ( true / false ) The BOOLEAN type represents a statement of truth (“true” or “false”). In SQL, the BOOLEAN field can also have a third state “unknown” which is represented by the SQL NUL
...or NULL will be filtered out. Consider the following example: Create a table with the values 5, 15 and NULL : CREATE TABLE integers (i INTEGER); INSERT INTO integers VALUES (5), (15), (NULL); Select all entries where i > 10 : SELECT * FROM integers WHERE... - https://man.mtool.work/duckdb/2.0/sql/data_types/boolean.html
- Numeric Types 8159
- Fixed-Width Integer Types The types TINYINT , SMALLINT , INTEGER , BIGINT and HUGEINT store whole numbers, that is, numbers without fractional components, of various ranges. Attempts to store values outside of the allowed range will result
...s not the signed equivalent of UINT8 , an unsigned, 8-bit integer. The type aliases INT1 , INT2 , INT4 and INT8 for signed integers were inherited from PostgreSQL, where digits in these names indicate their size in bytes , whereas the type aliases for th.... The BIGINT and HUGEINT types are designed to be used when the range of the integer type is insufficient. Variable-Length Integers The previously mentioned integer types all have in common that the numbers in the minimum and maximum range all have the s...at involve fixed-point decimals and accordingly returns floating-point data types. Internally, decimals are represented as integers depending on their specified WIDTH . Width Internal Size (bytes) 1-4 INT16 2 5-9 INT32 4 10-18 INT64 8 19-38 INT128 16 Per... - https://man.mtool.work/duckdb/2.0/sql/data_types/numeric.html
- Constraints 8113
- In SQL, constraints can be specified for tables. Constraints enforce certain properties over data that is inserted into a table. Constraints can be specified along with the schema of the table as part of the CREATE TABLE statement . In cert
...int . See the Indexes page for more details. You can also define a uniqueness constraint on multiple columns: CREATE TABLE integers (i INTEGER, j INTEGER, k INTEGER, UNIQUE (i, j)); INSERT INTO integers VALUES (1, 2, 3); INSERT INTO integers VALUES (1, 4..., 5); INSERT INTO integers VALUES (1, 2, 5); Constraint Error: Duplicate key "i: 1, j: 2" violates unique constraint. Foreign Keys Foreign keys defin... - https://man.mtool.work/duckdb/2.0/sql/constraints.html
- Query 8019
- The duckdb_query method allows SQL queries to be run in DuckDB from C. This method takes two parameters, a (null-terminated) SQL query string and a duckdb_result result pointer. The result pointer may be NULL if the application is not inter
...idual columns. Example duckdb_state state; duckdb_result result; // create a table state = duckdb_query(con, "CREATE TABLE integers (i INTEGER, j INTEGER);", NULL); if (state == DuckDBError) { // handle error } // insert three rows into the table state =...duckdb_query(con, "INSERT INTO integers VALUES (3, 4), (5, 6), (7, NULL);", NULL); if (state == DuckDBError) { // handle error } // query rows again state = duckd...b_query(con, "SELECT * FROM integers", &result); if (state == DuckDBError) { // handle error } // handle the result // ... // destroy the result after we are d... - https://man.mtool.work/duckdb/2.0/clients/c/query.html
DuckDB 2.0 Documentation / man.mtool.work