python mysql veritabanındaki değeri 0 olan ilk elemanı çağırma

import mysql.connector

config = {
    'host': 'localhost',
    'user': 'your_username',
    'password': 'your_password',
    'database': 'your_database'
}

cnx = mysql.connector.connect(**config)
cursor = cnx.cursor()

query = "SELECT * FROM your_table WHERE your_column = 0 LIMIT 1"
cursor.execute(query)

result = cursor.fetchone()

cursor.close()
cnx.close()

print(result)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *