- Use The Same Database Table That You Designed In The Previous Assignment For Database Design Form And Apply It To A Pyt 1 (89.49 KiB) Viewed 21 times
Use the same database table that you designed in the previous assignment for Database Design Form) and apply it to a Pyt
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Use the same database table that you designed in the previous assignment for Database Design Form) and apply it to a Pyt
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 main connect_to_db display_menu db conn, db cursor insert_row select_all select_row update_row delete_row Return None db db cursor conn, db db cursor cursor None DDL (Data Definition Language) create_table db cursor None drop_table db cursor None DML (Data Manipulation Language) (CRUD) Processing Call connect_to_db. Call display_menu. Connect to the database. Get database cursor. db cursor None. Ask user for field values. Execute SQL: insert db cursor None db cursor None 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. None Execute SQL: create Execute SQL: drop Execute SQL select without where. Print results. Ask user for key. Execute SQL select with where. Print results. Ask user for key. Ask user for new field values. Execute SQL: update. Ask user for key. Execute SQL: delete.