Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the schema from Part 2-c in SQLite and populate it with data of at least 6 students, 3 courses, and 7 enrollments (at least

Create the schema from Part 2-c in SQLite and populate it with data of at least 6 students, 3 courses, and 7 enrollments (at least one of the students should not be enrolled in any courses and at least one course should have zero current enrollments).

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. Do not submit each part in a separate .py file.

Create a view that joins the three tables, including all of the records from student table (i.e., including the non-enrolled students).

Write and execute python code that uses that view to export all data into a single .txt file (that is a de-normalized 1NF file with some redundancy present). This code should include NULLs due to the non-enrolled students.

Include a screenshot of the output .txt file (in addition to the python code)

Add a new row to the de-normalized .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)

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 pre-joined .txt file, not in the SQLite database, so this solution must read data from .txt file.

Suppose I have a new query: Qe: For every department, display the min and max graduation years.

Use the view from Part 4-a to re-write query Qe (i.e., replace the tables in the querys FROM clause by the view and rewrite the rest of the query accordingly to produce an answer).

Use your .txt file containing de-normalized data from part-b to answer Qe with python instead of SQL. Note that this solution should not use SQLite or SQL, just python.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

What is the cerebrum?

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago