Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a file Assignment 6 . sql and add commented queries that do what is needed for the tasks that follow. When creating a table
Create a file Assignmentsql and add commented queries that do what is needed for the tasks that follow.
When creating a table tablename or view wiewname, use this syntax to avoid errors when rerunning:
DROP TABLE IF EXISTS tablename;
CREATE TABLE tablename...
CREATE OR REPLACE VIEW viewname AS SELECT...
followed by the statement that generates the content of the table or view
Create a table gradepoints grade points that maps letter grades to number grades.
The highest grade is A the lowest is F and a and respectively increase decrease the value by ie B and B There is no grade A or F
Set grade as your primary key, both because it is inherently appropriate to have a primary key and because you need it or at least a unique constraint for the foreign key in the next task.
Create a "check constraint" to ensure that the points attribute is within the range The syntax for a check constraint is CONSTRAINT constraintname CHECKconstraint conditions... Beware that some older versions of MySQL parse and store the check constraint, but do not enforce it; go ahead and add it and dont worry if it isnt enforced.
Add a foreign key from the grade column in the existing takes table to the new gradepoints table.
Use the syntax ALTER TABLE tablename followed by the changes to the table
Create a view vtakespoints that returns the data in takes table along with the numeric equivalent of the grade.
Compute the total number of grade points credits grade points earned by student X pick a student id from the DB You will need to join takes, course, and the new gradepoints tables. If the student is in the system, but hasn't taken any courses, the student's total points is
Compute the GPA ie total grade points total credits for the same student in the previous question.
Find the GPA of all students, ie not just for one student at a time.
Create a view vstudentgpa id gpa that gives a dynamic version of the information in the previous question.
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