Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Video Store 12 points] Recall the movie database example given in class. In this question, you are to complete two functions in the following

image text in transcribed

Question: Video Store 12 points] Recall the movie database example given in class. In this question, you are to complete two functions in the following cell using the table movies from videostore.db For the function allMovies() , return a list of all movie records where each record is in the form of tuple. For example, if table movies of videostore.db contains only two records, say: (101, 'Casablanca, 'drama romance' 'PG') (102, Back to the Future', 'comedy adventure', PG) then the function should return the list (101, Casablanca', 'drama romance', PG), (182, Back to the Future', comedy adventure', 'PG') The function addMovie(movieid, title, genre, rating) takes four inputs to add a new movie record to the database. For simplicity, you may assume that all inputs to addMovies(..) are appropriate In import sqlite3 def allMovies): dbsqlite3.connect('videostore.db') #construct the appropriate SQL query to get all movie records #from the table movies, and return the List containing all #mone records where each movie record is in the form of a tuple db.close() def addMovie(movieid, title, genre, rating): db -sqlite3.connect('videostore.db') #construct the appropriate SQL query to insert a new movie data #to the table moves db.close) In t J: data-allMovies() addMovie(121, 'Born in China' 'documentary', 'PG' to check if the new movie has added to the database data.append ( (121, 'Born in China', 'documentary', 'PG')) assert set(data) set (allMovies))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Explain the procedure for valuation of shares.

Answered: 1 week ago

Question

Which months of this year 5 Mondays ?

Answered: 1 week ago

Question

Define Leap year?

Answered: 1 week ago

Question

=+what kinds of policies and practices should be developed?

Answered: 1 week ago