Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Database systems(help needed urgently) thanks. Enrollment SID CCode Midterm Final Total 100 BD445 70 77 CCode 150 BA200 65 89 BA200 Course CTime Room Nbrst

Database systems(help needed urgently) thanks.

image text in transcribed

Enrollment SID CCode Midterm Final Total 100 BD445 70 77 CCode 150 BA200 65 89 BA200 Course CTime Room Nbrst Avg Total MWF9 SC110 3 MWF3 SC213 3 MWFB SC213 1 MWF3 EA304 2. 200 BD445 71 Student SIDSName Major Year Age 100 Jones History GR 21 150 Parks Accounting so 19 200 | Baker Math GR 50 250 | Glass History SR 50 300 Baker Accounting SR 41 350 Russell Math JR 20 400 Rye Accounting GR 18 450 Jones FR 24 93 BD445 BF410 93 98 88 99 CS150 100 CS250 MWF12 EB210 2 78 68 54 200 CS250 300 CS150 400 BA200 400 30445 400 BF410 400 CS150 400 CS250 450 BA200 History 47 69 33 55 86 87 81 79 Notes: Course.Nbrst: number of students taking that course. Course.Avg Total: average of Totals of student-course enrollments from table Enrollment for a related course. Enrollment. Total: summation of 40% of Midterm and 60% of Final. 1) [60 pts] Implement a stored procedure sp_UpdateAvg Total (Course.CCode) such that exec sp_UpdateAvg Total (Course.CCode) updates the field Avg Total of table Course The field Avg Total is the average of Totals of student-course enrollments from table Enrollment for a related course. In order to calculate field Avg Total of table Course, field Total of table Enrollment is first to be computed by adding 30% of Midterm and 70% of Final. Create a table for logging errors before creating sp_UpdateAvg Total. Name the table as Log, table will have three fields: LogID, CCode, ErrCode. The primary key will be Logid. The field Login will be an identity column, CCode will be corresponding Ccode that is to be entered, and ErrCode will be "r" for "calling invalid course" (i.e. not available in table Course), "NC" for "no enrolled course" (1.e. not available in table Enrollment). You have to enter appropriate records to the table Log. After these errors, the transaction will be rolled back. Data types for the fields are as follows: LogiDint; CCode varchar(8); ErrCode varchar(2)

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

Students also viewed these Databases questions