Delete & close

Report a typo

Organize the following code to delete data, print the result, commit the changes, and don't forget to close the cursor and connection! Yes! In that order!

Reorder lines using drag or arrows. Adjust indentation with left buttons
                conn.close()
              
                conn = sqlite3.connect('company.db')
              
                cursor.close()
              
                print("Total employees affected: ", cursor.rowcount)
              
                cursor = conn.cursor()
              
                conn.commit()
              
                import sqlite3
              
                cursor.execute("""DELETE FROM EMPLOYEE WHERE AGE > 55""")
              
___

Create a free account to access the full topic