Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7826957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:38:22+00:00 2026-06-02T09:38:22+00:00

See the tables : http://dl.dropbox.com/u/10356431/Shared/screen.png Please help me to construct a SQL to find

  • 0

See the tables : http://dl.dropbox.com/u/10356431/Shared/screen.png

Please help me to construct a SQL to find the correctly answered questions in an online test for a particular test_id.

I have constructed one.

SELECT COUNT(UNIQUE d.question_id) AS CORRECT
FROM test_response d,
     question_response r
WHERE d.response_id   = r.question_resp_id
AND r.correct_response_flag != 'N'
AND d.test_id = '10113'

But the problem is while it will find the single choice questions accurately, it won’t if its a multi-choice as suppose out of 4 responses 2 are correct, choosing one will count it as a correctly answered question which is inaccurate.

Logic: A question set is generated and show to the user. Each test has its own id using a particular question set. The responses chosen by the user are stored in the test_response table.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:38:26+00:00Added an answer on June 2, 2026 at 9:38 am

    UPDATE: this does not work for OP’s table design where 2 rows are created for 4-answer questions

    i think you need to first check each question if it has all answers correct and then count the questions without incorrect answers:

    select
      count(*) - count(incorrect_answers_per_question) correct
    from (
      select
        d.test_id,
        d.question_id,
        sum(case when r.correct_response_flag = 'N' then 1 end) incorrect_answers_per_question
      from test_response d
      join question_response r on d.response_id = r.question_resp_id
      where d.test_id = '10113'
      group by d.test_id, d.question_id
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really struggling with this query. I have 4 tables (http://oberto.co.nz/db-sql.png): Invoice_Payement, Invoice, Client
You can see an interesting table at this link. http://norvig.com/21-days.html#answers The table described, Mutex
I'm using SQL-SERVER 2005. I have two tables as you can see on diagram,
I have a table called informations (http://pastebin.com/h3UiUhpx) and also have this associated tables educations,
Please see http://jsfiddle.net/jaWjB/1/ The line break happens in between the second image and its
I have this function: http://pastebin.ca/2058418 It basically checks to see if a tables contains
Lets take the example from Yelp: http://www.yelp.com/boston You can see that it's a website
Simple question See http://homepages.tcp.co.uk/~m-wigley/gc_wp_ded.html Ok there are 3 tables ACCOUNT, JOURNAL, and POSTING If
SEE: http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false I'm using MySQL. Given a partial or complete address, the Google Map
I'm using the javascript class sorttable for my tables (see here: http://www.kryogenix.org/code/browser/sorttable/ ) However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.