Put it all together

Report a typo

We are going to work with the database that contains the Students and Department tables. Here's what they look like:

  • Department:

id

name

1

Engineering

2

Mathematics

45

Physics

  • Students:

id

full_name

email

GPA

department

1

Alan Turing

[email protected]

9.5

1

2

Katherine Johnson

[email protected]

10

2

3

Helen Quinn

[email protected]

8.7

45

Ask the user for a department name, use the department's name to find out its id. Then, use the student information that is defined below, and insert a new student in the Students table. Finally, commit the changes. The cursor has been previously defined.

Sample Input 1:

Engineering

Sample Output 1:

(19, 'Percy', '[email protected]', 9.2, 1)
Write a program in Python 3
# Please don't modify the predefined variables below
id = 19
full_name = "Percy"
gpa = 9.2

# your code here
...
___

Create a free account to access the full topic