Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 calculate difficulty level

Author  Topic 

pablrodr
Starting Member

3 Posts

Posted - 2010-08-10 : 11:29:55
Good afternoon,

I'm trying to calculate the difficulty level of some exercises, each exercise is identified by a numeric id and the difficulty level is defined by its parameters, each exercise has a different number of parameters.

To calculate the difficulty level for each exercise we identify all the possible values that each parameter can take, those values are given to us in a specific (and correct) order in a table, and we assign a numeric value starting from 1 to each one of it, for example if the values of parameter p are p1,p2 and p3 we have to assign a number starting from 1 to each of them:
p1=1
p2=2
p3=3

Once assigned this values to each parameter, the difficulty level of the exercise is the sum of the values of every parameter.

Given an execution of the i exercise in a table:
Id Parameters Values
i p p2
i q q3
i r r1
the three lines above should be replaced by one line
Id Difficultylevel
i 2+3+1

Any help please

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-10 : 13:12:33
where do you set the values for p2,q3 etc as 2,3,etc?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pablrodr
Starting Member

3 Posts

Posted - 2010-08-10 : 14:52:48
I don't know where to set those values, but there's a fixed number of exercises ( 100 more or less) and for each exercise I've got the parameters and the values that those parameters take are ordered according to their difficulty, because the designers of the exercises gave those data to me, part of the problem is how to store those values, for the moment I have one table with 4 columns: Id, Parameter, Value and AssignedValue where Id is the identification of the exercise, Parameter are the parameters, Value are for each parameter its (ordered) possible values. For example:
Id Parameter Value AssignedValue
1 p1 100 1
1 p1 200 2
1 p1 300 3

where Id (p1,100) is easier than Id(p1,200)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-10 : 15:08:31
then isnt it matter of summing difficulty levels after grouping by Id?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pablrodr
Starting Member

3 Posts

Posted - 2010-08-11 : 04:03:21
I can't see how because now I have a table of exercises executions:

Id Parameters Values
i par1 300
i par2 4
i par3 8
j par8 200
j par8 7

meaning that exercise i was executed using parameters par1, par2 and par3.
par1 was executed with a value of 300
par2 was executed with a value of 4
and par3 with a value of 8

I have another table for the assignement of values to that parameters:
Id Parameter Value AssignedValue
i par1 50 1
i par1 75 2
i par1 300 3
i par1 350 4
i par2 2 1
i par2 3 2
.....


This means that for exercise i parameter par1 can take the values 50,75,300 or 350 and that for 50 it is assigned a 1 value of difficulty, for 75 it is assigned a 2 value of difficulty, 300 is assigned a 3 value of difficulty and 350 is assigned a 4 value of difficulty.. and so on for par2.


For calculating the difficulty of an exercise I need to sum all the difficulty values of all the parameters of that exercise..
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-08-11 : 10:07:26
Help us help you: Follow the link, then give us the information we need.

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -