SQL Trigger to Update a Table Row - TechRepublic
Question
September 2, 2009 at 07:18 AM
suzmarie10

SQL Trigger to Update a Table Row

by suzmarie10 . Updated 16 years, 9 months ago

I am creating a database to store records about classroom changes at the university level. Here is my database schema as of yet:

Courses (sessionCode, deptNo, courseNo, sectionNo, blgd, roomNo, name, maxEnroll, noEnrolled)

CourseInstructors (sessionCode, deptNo, courseNo, sectionNo, instructorID)

Rooms ( bldg, roomNo, maxCapacity)

CourseDetails (sessionCode, deptNo, courseNo, sectionNo, bldg, roomNo, day, timeStart, timeEnd, reqID)

Faculty (ID, name, deptNo?)

ReqChange (sessionCode, deptNo, courseNo, sectionNo, reqID , bldg, roomNo, day, timeStart, dateEntered, status, ID)

ReqProcedures (sessionCode, deptNo, courseNo, sectionNo, reqID, bldg, roomNo, day, startTime, proceduresComplete)

ReqReasons (sessionCode, deptNo, courseNo, sectionNo, reqID, reason)

ReqComments (sessionCode, deptNo, courseNo, sectionNo, reqID, comment)

I am wondering if there is a way to constantly update the courses table to only hold one value for each course and that value being the row in reqChange that has the most recent dateEntered and a complete status. Can i use a trigger here? Thanks

This discussion is locked

All Comments