LouieFord

Untitled

Mar 16th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import sqlite3
  2. myconnection = sqlite3.connect("movie.db")
  3. mycursor = myconnection.cursor()
  4.  
  5. favGenre = input("Enter your favourite Genre of film: ")
  6. favYear = int(input("Enter the year of the film: "))
  7.  
  8. mycursor.execute("""
  9. SELECT film.title, genre.genreName, film.releaseYear
  10. FROM film
  11. INNER JOIN filmgenre ON film.filmID = filmgenre.filmID
  12. INNER JOIN genre ON filmgenre.genreID = genre.genreID
  13. WHERE genre.genreName = ? AND film.releaseYear = ?""",
  14. (favGenre,favYear))
  15.  
  16. i=0
  17. singleJoinRecord = mycursor.fetchone()
  18. while singleJoinRecord:
  19. print("Film ",i," ",singleJoinRecord)
  20. i+=1
  21. singleJoinRecord=mycursor.fetchone()
Advertisement
Add Comment
Please, Sign In to add comment