import mysql.connector connection = mysql.connector.connect( host = "localhost", user = "root", password = "password", database = "python" ) cursor = connection.cursor() # cursor.execute("drop table conatcts") cursor.execute("create table contacts(id int, name varchar(20), email varchar(20))") insert_query = "INSERT INTO contacts (name, email) VALUES (%s, %s)" contact_data = ("Shaad Qureshi", "shaadgamer@gmail.com") cursor.execute(insert_query, contact_data) connection.commit() retrieve_query = "SELECT * FROM contacts" cursor.execute(retrieve_query) records = cursor.fetchall() for record in records: print(f"ID: {record[0]}, Name: {record[1]}, Email: {record[2]}") # Close the cursor and connection cursor.close() connection.close()