import sqlite3 # Connect to the database conn = sqlite3.connect('BookCollection.db') # Define the SQL query query = ''' SELECT Authors.Surname, Authors.Name, Books.Title FROM Authors INNER JOIN Books ON Authors.AuthorID = Books.AuthorID ORDER BY Authors.Surname, Books.Title ''' # Execute the query and print the results cursor = conn.cursor() for row in cursor.execute(query): print(row) # Close the database connection conn.close() import sqlite3 conn = sqlite3.connect('BookCollection.db') cursor = conn.cursor() for row in cursor.execute('''SELECT Surname, Name, Title FROM Authors, Books WHERE Authors.AuthorID = Books.AuthorID ORDER BY Surname, Name, Title;'''): print(row) cursor.close()