Question: 1. Connect mySQL database by using Python. 2. (10 points) Create database and tables as given below by using Python. (a) RESTAURANT database (b)

1. Connect mySQL database by using Python. 2. (10 points) Create database and tables as given below by using Python. (a) RESTAURANT database (b) MEAL: meal_id integer, meal_name varchar, cook_time time (c) INGREDIENTS: ing_id integer, ing_name varchar, preserve_time in- teger, ing_bought date (d) RECIPE: meal_id integer, ing_id integer Choose primary and foreign keys depending on the relations in RESTAU- RANT database design. 3. (20 points) Create arrays of at least 5 different records. Use these arrays to populate each table in the database. 4. (30 points) Apply the functions given below and print the results BASIC + cook_time 02:30:00 (MEAL) RESULT1+Tmeal_name (BASIC) RESULT2+ meal_name (ADVANCED) Umeal_name( RESULT3+ (MEAL INGREDIENTS) (BASIC) RESULTAT(ADVANCED meal_id-meal_id RECIPE) 5. (20 points) Print name of the meals which cook time is less than 1 hour and its ingredient is bought in 1 week time. 6. (20 points) Define Python functions for each table to insert a new record. For example, def insertMeal (id, name, lastname, cookTime). Note: Ensure that your programs are fully documented, using com- ments.
Step by Step Solution
3.41 Rating (167 Votes )
There are 3 Steps involved in it
PYTHON CODE import mysqlconnector Connect to the MySQL database mydb mysqlconnectorconnect hostlocalhost useryourusername passwordyourpassword databas... View full answer
Get step-by-step solutions from verified subject matter experts
