import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",database="bank")
mycursor=mydb.cursor();
mycursor.execute("CREATE TABLE customer(Cust_ID int(3) Primary key, Name char(20), country char(10))")
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root".passwd="root",database="bank")
mycursor=mydb.cursor();
sql="insert into customer(Cust_ID,Name,country) values (%s,%s,%s) "
val=(101,"Bhuvanesh","India")
mycursor.execute(sql,val)
mydb.commit()
print(mycursor.rowcount,"1 Record inserted")
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root".passwd="root",database="bank")
mycursor=mydb.cursor();
mycursor.execute("select country,count(country) from customer group by country")
myresult=mycursor.fetchall()
for x in myresult:
print(x)
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",database="bank")
mycursor=mydb.cursor();
mycursor.execute("CREATE TABLE customer(Cust_ID int(3) Primary key, Name char(20), country char(10))")
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root".passwd="root",database="bank")
mycursor=mydb.cursor();
sql="insert into customer(Cust_ID,Name,country) values (%s,%s,%s) "
val=(101,"Bhuvanesh","India")
mycursor.execute(sql,val)
mydb.commit()
print(mycursor.rowcount,"1 Record inserted")
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root".passwd="root",database="bank")
mycursor=mydb.cursor();
mycursor.execute("select country,count(country) from customer group by country")
myresult=mycursor.fetchall()
for x in myresult:
print(x)
No comments:
Post a Comment