TIF_E41253310/archive/compare_pekerjaan.py

37 lines
1.2 KiB
Python

import pymysql
conn = pymysql.connect(host='localhost', user='root', password='', database='tracerstudy_db', port=3306, charset='utf8mb4')
cursor = conn.cursor()
# Cek di tabel pekerjaan
cursor.execute('SELECT COUNT(*) FROM pekerjaan')
total_pekerjaan = cursor.fetchone()[0]
cursor.execute('SELECT COUNT(*) FROM pekerjaan WHERE nama_perusahaan IS NOT NULL AND nama_perusahaan != ""')
np_filled = cursor.fetchone()[0]
cursor.execute('SELECT COUNT(*) FROM pekerjaan WHERE jabatan IS NOT NULL AND jabatan != ""')
jabatan_filled = cursor.fetchone()[0]
print('=== PERBANDINGAN: pekerjaan vs tracer_responses ===')
print()
print(f'Total pekerjaan: {total_pekerjaan}')
print(f' - nama_perusahaan terisi: {np_filled} ({np_filled/total_pekerjaan*100:.1f}%)')
print(f' - jabatan terisi: {jabatan_filled} ({jabatan_filled/total_pekerjaan*100:.1f}%)')
print()
# Sample data dari pekerjaan
cursor.execute('''
SELECT alumni_id, nama_perusahaan, jabatan
FROM pekerjaan
WHERE nama_perusahaan IS NOT NULL AND nama_perusahaan != ""
LIMIT 5
''')
print('=== SAMPLE DATA di tabel pekerjaan ===')
for row in cursor.fetchall():
alumni_id, np, jab = row
print(f'ID {alumni_id}: perusahaan="{np}", jabatan="{jab}"')
conn.close()