Here is class 12 computer science Unit 16 solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 16 and for all chapters here.Sumita Arora Solutions for all lessons here.
After having MySQLdb installed on your local machine run the below command $ import MySQLdb Now opening the Open database connection $ db = MySQLdb.connect("localhost","testuser","test123","TESTDB") Now creating a cursor to the active database for operation $ cursor = db.cursor() $ data = cursor.fetchone() $ print ("Database version : %s ", % data)
$ import mysql.connector as sql #importing the package $ obj = sql.connect(host ="localhost", user="root", passwrd="MYpass", database="test") $ cursor = obj.cursor() # creating the cursor the database object $ cusor.execute("SELECT * FROM Student WHERE grade is 'A'") # executing the query
The above code will print 0 as no row has been fetched yet. But beyond that an update command will execute changing name to CSS where id is 2.
The above code will fetch all those records from staff where person_id is either of 1, 3, 4 in the database.
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
You cannot copy content of this page