import mysql.connector cnx = mysql.connector.connect(user='alice', password='tiger', host='sql.cs.oberlin.edu', database='imdb', auth_plugin='mysql_native_password') cursor = cnx.cursor() query = ("select title,year from imdb.productions where title like 'Land of the %'" "and (type='movie' or type='tvMovie' or type='tvSeries') order by title,year") cursor.execute(query) for (title,year) in cursor: print("{} ({})".format(title,year)) cursor.close() cnx.close()