How often Database handling is asked
3 of 3
papers asked it
avg 46 marks · last May 2018
Worth 1–10 marks when it appears as a written question.
Where it was asked
The questions
May/Jun 2018, Q4.13 marks
In terms of the components required, explain how Python code is connected to a database server.
May/Jun 2018, Q4.23 marks
Name at least four functions that can be used when accessing data from a database. For each function named, provide a coded line that illustrates and enhances your explanation.
May/Jun 2018, Q4.34 marks
Consider the following Python code, contained in a file called createtable.py, which is used to create a database table: import sys import MySQLdb conn = MySQLdb.connect(host="localhost", user="root", passwd="psw", db="surprise") cursor = conn.cursor() try: cursor.execute(""" create table students (learner_id smallint NOT NULL, learner_name char(50), modules smallint, bonus_balance float) """) except MySQLdb.Error: print ("Error in creating learner table") sys.exit(1) cursor.close() conn.close() Name the fields created in this students table together with the data type used for each field.
May/Jun 2018, Q5.14 marks
Explain why error handling is needed in a database, and use coded examples to show how such error handling can be built into the data-handling code.
May/Jun 2018, Q5.24 marks
Define what database maintenance is and explain why it is necessary, giving examples from your own application of where database maintenance was implemented.
The full Spot Map and the marks by year.