Question: Part One Make a new file database _ generator.py - inside this file you must include SQL query to create a database, create a table

Part One
Make a new file database_generator.py - inside this file you must include SQL query to create a database, create a table called Products, and it must require these columns:
id, name, price, quantity and quality
Write query to Insert these values
0, Apple,$0.75,120,Fresh
1,Banana,$0.40,200,Ripe
2,Orange,$0.60,150,Juicy
3,Carrot,$0.30,300,Crisp
4,Grapes, $1.20,80, Sweet
Include a query to select all data and print them all.
NOTE: You are not required to have main function in this file.
Part Two
Make a new file
main.py, first thing this file needs to do is connect to the database created by databe_generator.py
When your program runs it must prompt following options.
Must print all data or a message saying there is no data found.
Must prompt user with more inputs to get all data needed to perform adding query. The most important input to check is ID, if ID is duplicate then keep asking user to give a
unique ID.
No need to check if name or other inputs are duplicate or not, just the ID input. Once data is inserted go back to main prompt and update the count (example shows in prompt
example section).
You can assume user will always give valid data for the rest of the input.
Ask user for an ID to search in the database. If there is a matching id in the database then print it otherwise print no data found message.
Prompt user for an id to delete, if id is present in the database then ask user one more time "Are you sure you want to delete data with id: 4? Y/N"
if ID was not found in the database then print a message of id not existing and go back to the main prompt.
if Y then delete data then go back to main prompt (update the data count).
Prompt examples for the functionality above
Welcome to Database reader, there are 5 rows currently in database:
(NOTE: number 5 above must be updated based on deletion and insertion of data).- do not include this in your program, this meant for an example.
1- To Print all data
2- To insert data
3- To find data
4- To delete data
or enter Q to quit
2
Please Enter Values for the following
ID: 2
ID is a duplicate, please enter unique ID
ID: 6
Name: Watermelon
Price: 2.99
Quantity: 20
Quality: Ripe
New data was entered to database
Welcome to Database reader, there are 6 rows currently in database:
(NOTE: notice 5 is now 6).- do not include this in your program, this meant for an example.
1- To Print all data
2- To insert data
3- To find data
4- To delete data
or enter Q to quit
4
Please enter ID of the data you want to delete
ID: 2
Are you sure you want to delete data with id: 2? Y/N
Y
Data was deleted
Welcome to Database reader, there are 5 rows currently in database:
(NOTE: notice 6 is now back to 5).- do not include this in your program, this meant for an example.
1- To Print all data
2- To insert data
3- To find data
4- To delete data
or enter Q to quit
Your submission MUST include these file:
database_generator.py - Must satisfy all requirements mentioned above.
main.py - must have main function in it. Failure to include main function in your submission will result in 0.
You can include more classes or functions if you would like, but these are minimum requirements.
 Part One Make a new file database_generator.py - inside this file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!