sqlite, join
$sqlite3 t.db .CREATE TABLE d (id INT PRIMARY KEY, name TEXT ); .INSERT INTO d VALUES(1, 'sales'), (2,'r&d'), (3, 'unknown'); .CREATE TABLE e (name TEXT, d_id INT REFERENCES d(id) ); .INSERT INTO e VALUES('tom', 1), ('jerry', 2), ('jone', 4), ('smith', NULL); .SELECT * FROM e, d; tom|1|1|sales tom|1|2|r&d tom|1|3|unknown jerry|2|1|sales jerry|2|2|r&d jerry|2|3|unknown jone|4|1|sales jone|4|2|r&d jone|4|3|unknown smith||1|sales smith||2|r&d smith||3|unknown .SELECT * FROM e INNER JOIN d ON id=d_id; tom|1|1|sales jerry|2|2|r&d .SELECT * FROM e LEFT JOIN d ON id=d_id; tom|1|1|sales jerry|2|2|r&d jone|4|| smith||| .SELECT * FROM e RIGHT JOIN d ON id=d_id; Error: RIGHT and FULL OUTER JOINs are not currently supported .SELECT * FROM d LEFT JOIN e ON id=d_id; 1|sales|tom|1 2|r&d|jerry|2 3|unknown||
SQLite Join - 菜鸟教程 | Join (SQL) - Detailed Pedia
But how? Three fundamental algorithms for performing a join operation exist: nested loop join, sort-merge join and hash join.
- A nested loop [嵌套循环] join is a naive algorithm that joins two sets by using two nested loops.
- The key idea of the sort-merge [归并排序] algorithm is to first sort the relations by the join attribute, so that interleaved linear scans will encounter these sets at the same time.
- Hash joins require an equijoin predicate (a predicate comparing records from one table with those from the other table using a conjunction of equality operators '=' on one or more columns). [=前面这么多修饰!]
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
2022-01-13 A Child's History of England.132
2022-01-13 ape
2022-01-13 apparatus
2022-01-13 app
2022-01-13 小白写给菜鸟看的消息队列简介
2022-01-13 apartment
2022-01-13 字节跳动笔试题-豆油瓶