# -*- coding: utf-8 -*- import sqlite3, io, sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') c = sqlite3.connect(r'backend\data\shuili_exam.db') cur = c.cursor() print('subject NULL vs not (user1, not deleted):') print(list(cur.execute("SELECT CASE WHEN subject IS NULL THEN 'NULL' ELSE 'set' END, COUNT(*) FROM notes WHERE user_id=1 AND is_deleted=0 GROUP BY 1"))) print('sample returned notes subject:') for r in cur.execute("SELECT id,subject FROM notes WHERE id IN (90,89,88,12,14) ORDER BY id"): print(' ', r)