""" Zjistí rozsah puzzle v sudoku_killer tabulce a počet. """ import sys from pathlib import Path sys.stdout.reconfigure(encoding="utf-8") sys.path.insert(0, str(Path(__file__).parent.parent.parent / "Knihovny")) from mysql_db import connect_mysql conn = connect_mysql(database="puzzle") cur = conn.cursor() cur.execute(""" SELECT puzzle_type_id, COUNT(*), MIN(puzzle_number), MAX(puzzle_number), MIN(puzzle_date), MAX(puzzle_date) FROM sudoku_killer GROUP BY puzzle_type_id """) for row in cur.fetchall(): print(f" type_id={row[0]}, count={row[1]}, nums={row[2]}-{row[3]}, dates={row[4]}-{row[5]}") cur.execute("SELECT id, name FROM puzzle_type") for row in cur.fetchall(): print(f" puzzle_type: id={row[0]}, name={row[1]}") cur.execute(""" SELECT COUNT(*) FROM puzzles WHERE game_type = 'killer_sudoku' """) print(f" Už v puzzles tabulce: {cur.fetchone()[0]}") cur.close() conn.close()