Question: Use the same database table that you designed in the previous assignment for Database Design Form ) and apply it to a Python program that

Use the same database table that you designed in the previous assignment for Database Design
Form) and apply it to a Python program that performs CRUD operations. You can change your
table design (if needed) based on feedback you may have received from your instructor. Your
table must have at least 6 columns (not 5 as shown in videos). Write a program to perform
database CRUD operations on your table. Create a menu as shown below. Write multiple
functions as shown below. You can change the functions slightly, but must write multiple
functions and perform parameter passing and returning values. Watch the videos as a guide
for writing this program. You can use all of the code as presented in the videos, but you must
use a different table & columns than what was presented in the videos. Do not use the same
table (book) that was presented in the videos. Your table must have at least 6 columns (not
the video of book table only has 5 columns)
Welcome to my database program!
Menu:
Enter S to get started and create a new database
Enter C to create a new row
Enter R to retrieve data
Enter U to update a row
Enter D to delete a row
Enter Q to quit the program
Enter your choice:
Function Name Parameters Return Processing
main ------ None Call connect_to_db. Call display_menu.
connect_to_db ------ db
conn,
db
cursor
Connect to the database.
Get database cursor.
display_menu db conn,
db cursor
None Loop: Display menu. Ask for user input. If invalid
menu choice, print error message and try again.
If valid, call appropriate function. Commit to the
database. Call select_all to display rows. Ask user
if want to loop again. Quit loop if user chooses.
DDL (Data Definition Language)
create_table db cursor None Execute SQL: create
drop_table db cursor None Execute SQL: drop
DML (Data Manipulation Language)(CRUD)
insert_row db cursor None Ask user for field values. Execute SQL: insert
select_all db cursor None Execute SQL select without where. Print results.
select_row db cursor None Ask user for key.
Execute SQL select with where. Print results.
update_row db cursor None Ask user for key. Ask user for new field values.
Execute SQL: update.
delete_row db cursor None Ask user for key. Execute SQL: delet

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 Programming Questions!