import psycopg2
conn = psycopg2.connect(host='192.168.0.61', port=55432, dbname='njts_acct', user='njts_app', password='njts_app2025')
cur = conn.cursor()

# bonusテーブル名確認
cur.execute("SELECT table_name FROM information_schema.tables WHERE table_name LIKE '%bonus%' OR table_name LIKE '%employee%'")
print("tables:", cur.fetchall())

# 王珏の賞与データを確認
cur.execute("""
    SELECT b.bonus_id, b.bonus_year, b.bonus_month, b.bonus_type, b.payment_date, b.child_support, b.total_bonus
    FROM bonus_payments b
    JOIN employees e ON b.employee_id = e.employee_id
    WHERE e.employee_code = '20190001'
    ORDER BY b.bonus_year DESC, b.bonus_month DESC LIMIT 5
""")
print("bonus data:", cur.fetchall())

cur.close()
conn.close()
