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 x in cursor: print(x) cursor.close() cnx.close()