1. Connect mySQL database by using Python. 2. (10 points) Create database and tables as given...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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<00:30:00 (MEAL) • ADVANCED + 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. 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<00:30:00 (MEAL) • ADVANCED + 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.
Expert Answer:
Answer rating: 100% (QA)
PYTHON CODE import mysqlconnector Connect to the MySQL database mydb mysqlconnectorconnect hostlocalhost useryourusername passwordyourpassword databas... View the full answer
Related Book For
Database Systems Design Implementation and Management
ISBN: 978-1337627900
13th edition
Authors: Carlos Coronel, Steven Morris
Posted Date:
Students also viewed these programming questions
-
Make a list of at least 5 systems that store energy, explaining which form of energy.
-
Make a list of at least 5 systems that store energy, explaining which form of energy.
-
Think of at least 5 routine decisions you make or systems that you interact with on a routine basis that are now designed with Artificial Intelligence algorithms and constructs. Identify and list how...
-
The management of Mecca Copy, a photocopying centre located on University Avenue, has compiled the following data to use in preparing its budgeted balance sheet for next year: Ending Balances...
-
What is the purpose of technical design review meetings? What are the two different types of technical design reviews? Who participates? What should be covered in each type of meeting?
-
A jar contains n chips. Suppose that a boy successively draws a chip from the jar, each time replacing the one drawn before drawing another. The process continues until the boy draws a chip that he...
-
Visit Trackur.com (www.trackur.com) and read about the services Trackur offers. Some analysts have referred to the practice of mining social media as being similar to conducting a focus group. Is...
-
Why did Toyota wait so long to publically acknowledge and replace the faulty accelerator pedals? Toyota is an extremely successful automaker that has built a reputation for quality by fostering a...
-
Discuss the concepts of mean, median, mode, and standard deviation. Include when each should be used and evaluate the differences of each.
-
The country of Emmental has three firms, whose information is displayed below (in thousands). Fill in the missing information (also in thousands). Assume that no international trade exists and that...
-
A fluid, whose viscosity is to be measured, is placed in the gap of thickness B between the two disks of radius R. One measures the torque T; required to turn the upper disk at an angular velocity 2....
-
Find a recent article in which someone or some group proposes a polygraph test to determine whether a person is being truthful. In light of what you know about polygraph tests, do you think the...
-
An economy operating its plant and equipment at full capacity implies a capacity utilization rate of _____. a) 40 percent b) 70 percent c) 85 percent d) 100 percent
-
Indicate true or false for the following statements. If false, specify what change will make the statement true. _______________________ The F distribution is symmetric and has a mean of 0.
-
The range and standard deviation use different approaches to measure variation in a data set. Construct two different data sets configured so that the range of the first set is greater than the range...
-
N = 230, n = 15, k = 200 Compute the mean and standard deviation of the hypergeometric random variable X.
-
What is the key requirement for a firm to have the ability to generate positive NPV in its projects? 2. Why might leasing be advantageous? 3. In financial distress firms may make sub-optimal...
-
Prove the following D,(cos x) = - sin x (Hint: Apply the identity cos(A + B) = cos A cos B sin A sin B)
-
Based on the following query: SELECT P_CODE, P_DESCRIPT, P_PRICE, PRODUCT.V_CODE, V_STATE FROM PRODUCT P, VENDOR V WHERE P.V_CODE = V.V_CODE AND V_STATE = NY AND V_AREACODE = 212; ORDER BY P_PRICE;...
-
As a discipline As a discipline, data visualization can be studied as _a group of visual communication techniques used to explore and discover data insights by applying: pattern recognition, spatial...
-
Global Unified Technology Sales (GUTS) is moving toward a bring your own device (BYOD) model for employee computing. Employees can use traditional desktop computers in their offices. They can also...
-
Laura says she doesnt believe that humans were at one time chimpanzees or gorillas. Jeff says he doesnt believe it either. Explain why biologists also dont believe that humans are descended from...
-
Write a letter to Grandma telling her about drug resistance in living organisms. Explain to her why drug resistance is such a common phenomenonincluding why insects become more resistant to...
-
During a drought, the supply of seeds available to a finch population decreases. The smaller, softer seeds, which are easier to crack, are quickly eaten up. Finches with larger, stronger beaks are...
Study smarter with the SolutionInn App