import sqlite3 # 连接到数据库 try: conn = sqlite3.connect('car_info.db') cursor = conn.cursor() # 获取car_owners表的结构 cursor.execute('PRAGMA table_info(car_owners)') rows = cursor.fetchall() print('car_owners表结构:') for row in rows: print(row) # 也检查query_history表的结构,了解两个表的关系 print('\nquery_history表结构:') cursor.execute('PRAGMA table_info(query_history)') rows = cursor.fetchall() for row in rows: print(row) except Exception as e: print(f'查询表结构时出错: {e}') finally: if conn: conn.close()