import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",database="school")
mycursor=mydb.cursor();
mycursor.execute("CREATE TABLE student1920(Roll int(2) Primary key, Name char(20), class int(2), DOB Date, Gender Char(1), City Char(10), Marks int(3))")
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root".passwd="root",database="studentl")
mycursor=mydb.cursor();
sql="insert into student1920(Roll,Name,class,DOB,Gender,City,Marks) values (%s,%s,%s,%s,%s,%s,%s) "
val=(01,"Nanda",10,1995/06/06,"M","Agra",551)
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="student")
mycursor=mydb.cursor();
mycursor.execute(" select sum(marks) from student1920 where city="Mumbai"")
myresult=mycursor.fetchall()
for x in myresult:
print(x)
Computer Science - Computer science is a scientific and practical approach to computation and its application. It contains two core parts hardware and software. Hardware is the physical machine where we run computer applications. Hardware has evolved and has made it possible for computing devices to become faster, smaller and more efficient. The software can be very complex. It combines algorithms, data structure, the input, output, and the intermediate storage of data. Computer science also deals with a graphical user interface which makes software programs more user-friendly. Today computers are an integral part of our lives. For more visit: Computer Mobile Info
ReplyDelete