there is a sql query problem in which i should find out which users have passed all of the tests.
here are the tables:
ex: nameoftable(nameofcolumns)
user(userid,password)
test(test#,creditpertrue,negperfalse,total,neededcredit)
{creditpertrue=points given per a right answer and negperfalse=points taken per a wrong answer
and total=is the total points of a test and neededcredit is the points to pass the test}
question(test#,q#,truechoice#)
user_test(userid,test#)
{this table shows that which user have taken which test(a user can only take a test once)}
user_test_question(uesrid,test#,q#,userchoice#)
{this table shows the choice of every user in every test and question# which may be wrong or right}
now the question is this:
find out the userid of users that have passed all of the tests.
a solution that came to my mind was this:
create 2 views like this:
view1:userid,test#,numberofrightchoices
and
view2:userid,test#,numberofwrongchoices
and then use a select on these 2views and use numberofrightchoices*creditpertrue-numberofwrongchoices*negperfalse>=neededcredit
is it possible?
I think that the query that you need to get a list of users who have passed all the tests would be this: