Class 12th CBSE CS

Write a Code to Insert Data from Python to MYSQL.

Solution: – 

import mysql.connector as cn s = cn.connect( host = "localhost", user = "root", passwd = "root", database = "bank", auth_plugin="mysql_native_password") mycursor = s.cursor() sql = "INSERT INTO bank (name, address) VALUES (%s, %s)" val = ("Hardik", "Althan") mycursor.execute(sql, val) s.commit() print(mycursor.rowcount, "record inserted.")

Fun & Easy to follow
Works on all devices
Your own Pace
Super Affordable

Popular Videos

UX for Teams

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

SEO & Instagram

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

Leave a Reply

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

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.