Database, Catalog and Schema Tables and Views Rows Columns
Attach/Detach
Data Types: General-Purpose Data Types Nested / Composite Types
Expressions:
Functions:
Configuration: setSELECT*FROM duckdb_settings();
Extensions:
CHECKPOINT the write-ahead log (WAL) SEQUENCE
a schema in the catalog: The default schema is main.
SQL Macro 支持两种宏类型,Scalar 和 Table 类型。
宏的作用在于让SQL获得进一步的概括和抽象能力,允许开发者将复杂的处理逻辑通过宏进行定义,然后在后续程序处理中可以反复引用这一定义。
PG中引入vacuum机制来清理旧数据和旧的事务。VACUUM会消耗I/O资源
vacuum主要分vacuum full和lazy vacuum
增 CREATETABLECOPYINSERTINTOVALUES
删 DELETEasDROPTABLE
改 UPDATEALTER TABL RENAME set
查 selectDISTINCTfromwheregroupbyORDERBYHAVING
阶段02:
Joins Between Tables: LEFTOUTERJOINON
Aggregate Functions: max
PIVOT ONandUSING UNPIVOT
WINDOW QUALIFY
持久化IO: CopyFromCopyTo EXPORT DATABASE
SUMMARIZE SELECT*FROM tbl;
点命令-Special commands to sqlite3 (dot-commands)
“点命令以点号(.)开头,不需要分号(;)来结尾
.databases List names and files of attached databases
.cd DIRECTORY Change the working directory to DIRECTORY
.open ?OPTIONS? ?FILE? Close existing database and reopen FILE
DuckDB requires CMake, Python3 and a C++11 compliant compiler
阶段05.开发
C++
打开或创建数据库
01.
./duckdb
02.Toopenorcreate a persistent database, simply include a path as a command line argument like
./duckdb path/to/my_database.duckdb
03.切换数据库
a new database connection can be made byusing the .open command
.open ?OPTIONS? ?FILE? Close existing database and reopen FILE
.quit Exit this program
(中途保存 ) ????
切换数据库--只是关闭一个连接并打开另一个连接
查看版本
CALL pragma_version();
.show()
查询当前数据库、当前用户
selectcurrent_database();
select current_user;
列举数据库,相当于mysql的show databases
-- List all databases, usually one
PRAGMA database_list;
列举表,相当于mysql的show tables
show tables;
相当于 help
元数据:select * fromduckdb_schemas();
数据类型: select * fromduckdb_types();
当前数据库的一些数据
about the current database. These functions reside in the main schema and their names are prefixed with duckdb_.
## select * from duckdb_databases();
duckdb_tables() duckdb_columns(); duckdb_indexes()
select * fromduckdb_constraints()
select * fromduckdb_views();
select * fromduckdb_functions();
SELECT * FROM duckdb_settings()
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)