question

Amber-Rose avatar image
Amber-Rose asked

SQL Exam Updates?????

Hello! My company have created a website where employees will be able to take a test to earn points (CPD hours) which will be updated every time an employee takes the test. I am trying to find a way to update the number of CPD hours each employee has earned by using SQL, and displaying this on their profile page. The number of CPD hours awarded will need to be updated every time they earn more points. Every time they take the test, 2 CPD hours will be added. **Any help on this would be much appreciated! :) Thanks!**
sql-server-2005updatehelptest
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image
ThomasRushton answered
If it's as simple as updating the hours each time they take the test, then you could update their hours in the data table by using something like: UPDATE CPDHours SET SQLHours = SQLHours + 2 WHERE UserName = 'Fred'
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

If the CPD hours are actually significant in some way, it may be worth also having an audit/log table tos how when and why the hours got changed.
1 Like 1 ·
This works perfectly, Thanks for the help! :)
0 Likes 0 ·
Grant Fritchey avatar image
Grant Fritchey answered
And in addition to what @ThomasRushton says, you need to have the web page run a query to retrieve the data from the database. Then, as the data gets updated, the web site will as the pages load.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you too! :)
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.