Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the schema from Part 2 - c in SQLite and populate it with data of at least 5 students, 4 courses, and 8 enrollments
Create the schema from Part c in SQLite and populate it with data of at least students, courses, and enrollments at least
one of the students should not be enrolled in any courses and at least one course should have zero current enrollments
StudentStudentID Name, Address, GradYear
GradeCName Studentip, CGrade
CourseCName Department, Credits
You can submit code in this document or as a separate py file. If you submit it separately, please clearly document which part
each answer matches. Please do not submit each part in a separate py file.
a Create a view that joins the three tables, including all of the records from student table ie including the non
enrolled students
b Write and execute python code that uses that view to export all data into a single txt file that is a denormalized"
NF file with some redundancy present This code should include NULLs due to the nonenrolled students.
Include a screenshot of the output txt file in addition to the python code
c Add a new row to the denormalized txt file you can manually edit the txt file from part b that violates the
following functional dependency:
CName Credits
you can do so by creating a new record that repeats the course name but does not repeat the number of credits
associated with this course name
d Write python code that will identify the values for which functional dependency was violated in your txt file hint:
when the functional dependency is valid, there is only one unique value of Credits for each CName Your solution
should detect any violation of the CName Credits functional dependency, not just your example. Keep in mind
that functional dependency is violated only in the prejoined txt file, not in the SQLite database, so this solution
must read data from txt file.
e Suppose I have a new query: : For every department, display the min, median, and max graduation years.
Use the view from Part a to rewrite query ie replace the tables in the query's FROM clause by the
view and rewrite the rest of the query accordingly to produce an answer
Use your txt file containing denormalized data from partb to answer with python instead of SQL
Note that this solution should not use SQLite or SQL language. Your solution should work for any input,
not just for specific department in your data.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started