Question: *Write a Python program that creates a new database named DSUCollege.db and calls 4 functions. The function named create_table will create a table in the
*Write a Python program that creates a new database named DSUCollege.db and calls 4 functions.
The function named create_table will create a table in the DSUCollege.db database called students that has five fields: student_id, first_name, last_name, major, and gpa. The first_name, last_name, and major columns should be TEXT data types, the student_id column should be an INTEGER datatype and gpa should be a REAL datatype (link to SQLite Data typesLinks to an external site.). Before creating the table, add code to drop the table. After the table has been created, display a message that the table has been created successfully.
The function named populate_table populates the students table with the following values:
| student_id | first_name | last_name | major | gpa |
| 1111 | Dave | Grohl | Music | 4.0 |
| 2222 | Belinda | Carlisle | Accounting | 3.5 |
| 3333 | Joe | Elliot | Computer Science | 2.8 |
| 4444 | Angus | Young | Accounting | 2.1 |
| 5555 | Susanna | Hoffs | Music | 3.1 |
| 6666 | Debbie | Harry | Computer Science | 3.4 |
| 7777 | Saul | Hudson | Music | 2.7 |
| 8888 | Paul | Hewson | Computer Science | 1.8 |
After the seven rows have been added, display a message that the table has been populated.
After the table has been populated a function named update_table should be called that creates and runs SQL statements to do the following:
Dave Grohl (id 1111) has graduated, delete him from the table and display a message that the delete was successful. Use the id field to locate the correct record to delete.
Paul Hewson (id 8888) has changed majors to Music, update his major to reflect the change and display a message that the update has been successful. Use the id field to locate the correct record to update.
Debbie Harry's (id 6666) gpa has increased to 4.0, update her gpa to 4.0 and display a message that the update was successful. Use the id field to locate the correct record to update.
After the updates have been completed, a function named query_table should be called that creates and runs the following queries:
Create a query to display all information about all students in alphabetical order (a to z) by last_name.
Create a query to display the first_name and last_name of all students who major in Music.
Create a query to display the first_name, last_name, major and gpa with gpa >= 3.0, order the query results by gpa in descending order.
Here is a sample run of the program:
YOU MUST USE SQLite TO COMPLETE THIS ASSIGNMENT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
