且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用python比较两个sqlite3表

更新时间:2023-12-01 13:29:10

制作两个文本文件.对它们进行排序.将它们与 diff 进行比较.

Make two text files. Sort them. Compare them with diff.

或者,将它们导入到SQLite表中.然后,您可以使用如下查询:

Alternatively, import them into SQLite tables. Then you can use queries like the following:

SELECT * FROM a INTERSECT SELECT * FROM b;
SELECT * FROM a EXCEPT    SELECT * FROM b;

获取在两个表中或仅在一个表中存在的行.

to get rows that exist in both tables, or only in one table.