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 7623359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:41:14+00:00 2026-05-31T04:41:14+00:00

how can I make this sql query return zero for the count function instead

  • 0

how can I make this sql query return zero for the count function instead of no rows selected?

select ur.uno, count(*)*5
from userresponse ur, question q
where ur.eno = q.eno 
  and q.correctanswer = ur.response 
  and q.qno = ur.qno 
  and ur.uno = '1' 
  and q.eno = '1'
group by ur.uno

q.correctanswer = ur.response is never true for this query that’s what causes the no row selected, however I want to return zero.

sample data

Note:
– “||” is used to concatenate strings
– each string is between a pair of single quotes.
– each record is between “(” and “)”.
– fields are ordered according to fields in tables
– “\n” means a new line

======exams data==========

(1,’Java Programming’,60,1)

(3,’Elementary History’,10,3)

======questions data===========

(1,1,’Choose the operations that can be performed on String
objects:(A) +\n(B) + =\n(C) -\n(D) %\n(E) ^’,’B’)

(1,2,’What will be the result of the expression\na % b\nwhen a and b
are of type int and their values are a = -17 and b = -6?’,’A’)

(1,3,’What will be the result of the expression\na % b\nwhen a and b
are of type int and their values are a = 10 and b = 6?’,’B’)

(1,4,’Consider the following code:\nint x, y, z\ny = 1\nz = 5\nx = 0
– (++y) + z++\nAfter execution of this, what will be the values of x, y and z?’,’C’)

(1,5,’Identify the statements that are correct:\n(A) int a = 13,
a>>2 = 3\n(B) int b = -8, b>>1 = -4\n(C) int a = 13, a>>>2 = 3\n(D)
int b = -8, b>>>1 = -4′,’E’)

(1,6,’If not assigned a value, a variable of type char has the
following default value:’,’A’)

(1,7,’What will be the value of a after execution of the following
statements:\nint a = 23, b = 34\na = ((a < b) ? (b + a) : (b –
a)’,’B’)

(1,8,’Which of the following is not a hexadecimal number?\n(A)
999\n(B) (hex)23\n(C) 0x556\n(D) 0x1F2′,’C’)

(1,9,’if(check4Biz(storeNum) != null) {}\nReferring to the above,
what datatype could be returned by method check4Biz()?’,’D’)

(1,10,’Select the invalid assignment statements from the
following:\n(A) float x = 238.88\n(B) double y = 0x443\n(C) int n =
(int) true\n(D) long m =778645′,’A’)

(1,11,’int j\nfor(int i=0i<14i++) {\nif(i<10) {\nj = 2 +
i\n}\nSystem.out.println(“j: ” + j + ” i: ” + i)\n}\nWhat is WRONG
with the above code?’,’E’)

(1,12,’Consider the following code:\nclass ClassA\n{\npublic static
void main(String args [ ])\n{\nClassB b = classB()\n}\nClassA(int x) {
}\n}\nclass ClassB extends ClassA\n{\n}\nWhat will happen when we
compile and run this code?’,’A’)

(1,13,’The keywords reserved but not used in the initial version of
Java are:\n(A) union\n(B) const\n(C) inner\n(D) goto\n(E) boolean\n(F)
synchronized’,’C’)

(1,14,’We would like to make a member of a class visible in all
subclasses regardless of what package they are in. Which one of the
following keywords would achieve this?’,’D’)

(1,15,’Which of the following are not keywords?\n(A) NULL\n(B)
implements\n(C) protected\n(D) extended\n(E) string’,’B’)

(3,1,’The Battle of Gettysburg was fought during which war?’,’C’)

(3,2,’Neil Armstrong and Buzz Aldrin walked how many \n’ ||
‘minutes on the moon in 1696?’,’B’)

(3,3,’Which Presidents held office during World War II?’,’D’)

(3,4,’In a communist economic system, people:’,’B’)

(3,5,’Which president did not die while in office?’,’D’)

(3,6,’Which state refused to attend the Constitutional Convention
\n’ ||
‘in 1787 because it didn”t want the United States government \n’ ||
‘to interfere with already established state affairs?’,’A’)

(3,7,’Who founded Buddhism?’,’A’)

(3,8,’Where is India?’,’D’)

(3,9,’What is the dominant religion in India?’,’B’)

(3,10,’Near which river did archaeologists find India”s \n’ ||
‘first civilization?’,’B’)

========== answerOption data ============

(3,8,’A’,’Australia’) (3,8,’B’,’America’) (3,8,’C’,’Africa’)
(3,8,’D’,’Asia’) (3,1,’A’,’World War II’) (3,1,’B’,’The
Revolutionary War’) (3,1,’C’,’The Civil War’) (3,1,’D’,’World War I’)
(3,2,’A’,’123′) (3,2,’B’,’None’) (3,2,’C’,’10’) (3,2,’D’,’51’)
(3,3,’A’,’Franklin D. Roosevelt’) (3,3,’B’,’Dwight D. Eisenhower’)
(3,3,’C’,’Harry Truman’) (3,3,’D’,’Both A and C’) (3,4,’A’,’Are
forced to work as slaves’) (3,4,’B’,’Work for the common good’)
(3,4,’C’,’Work from home computers’) (3,4,’D’,’Don”t work’)
(3,5,’A’,’John F. Kennedy’) (3,5,’B’,’Franklin D. Roosevelt’)
(3,5,’C’,’Abraham Lincoln’) (3,5,’D’,’Ronald Reagan’)
(3,5,’E’,’James A. Garfield’) (3,7,’A’,’Siddharta Gautama’)
(3,7,’B’,’Jesus Christ’) (3,7,’C’,’Mahatma Gandhi’)
(3,7,’D’,’Muhammad’) (3,6,’A’,’Rhode Island’) (3,6,’B’,’New
Hampshire’) (3,6,’C’,’New Jersey’) (3,6,’D’,’New York’)
(3,9,’A’,’Islam’) (3,9,’B’,’Hinduism’) (3,9,’C’,’Christianity’)
(3,9,’D’,’Buddhism’) (3,10,’A’,’The Tiber River’) (3,10,’B’,’The
Indus River’) (3,10,’C’,’The Yellow River’) (3,10,’D’,’The Nile
River’) (1,1,’A’,'(D) & (E)’) (1,1,’B’,’ (A) & (B)’) (1,1,’C’,'(D)’)
(1,1,’D’,'(A)’) (1,1,’E’,’None of these’) (1,2,’A’,’-17′)
(1,2,’B’,’5′) (1,2,’C’,’3′) (1,2,’D’,’-5′) (1,2,’E’,’None of these’)
(1,3,’A’,’1.66′) (1,3,’B’,’4′) (1,3,’C’,’2′) (1,3,’D’,’1′)
(1,3,’E’,’None of these’) (1,4,’A’,’x = 4, y = 1, z = 5′) (1,4,’B’,’ x
= -7, y = 1, z = 5′) (1,4,’C’,’x = 3, y = 2, z = 6′) (1,4,’D’,’ x = 4, y = 2, z = 6′) (1,4,’E’,’ x = 8, y = 2, z = 1′) (1,5,’A’,'(C) & (D) ‘)
(1,5,’B’,’ (A), (B) & (C) ‘) (1,5,’C’,'(A), (B), (C) & (D)’)
(1,5,’D’,'(A) & (B) ‘) (1,5,’E’,’None of the above’)
(1,6,’A’,’\uffff’) (1,6,’B’,’\u0000′) (1,6,’C’,'” ” (space)’)
(1,6,’D’,’\u0001′) (1,6,’E’,’None of the above’) (1,7,’A’,’23’)
(1,7,’B’,’Error. Cannot be executed.’) (1,7,’C’,’57’) (1,7,’D’,’11’)
(1,7,’E’,’34’) (1,8,’A’,'(A), (B) & (C)’) (1,8,’B’,'(C)’)
(1,8,’C’,'(A) & (B) ‘) (1,8,’D’,'(A)’) (1,8,’E’,'(D)’)
(1,9,’A’,’Boolean’) (1,9,’B’,’Int’) (1,9,’C’,’String’)
(1,9,’D’,’Char’) (1,9,’E’,’Byte’) (1,10,’A’,'(A) & (C)’)
(1,10,’B’,'(A) & (B)’) (1,10,’C’,'(B) ‘) (1,10,’D’,'(B) & (D) ‘)
(1,10,’E’,'(D)’) (1,11,’A’,’Integer “j” is not initialized.’)
(1,11,’B’,’Nothing.’) (1,11,’C’,’You cannot declare integer i inside
the for-loop declaration.’) (1,11,’D’,’The syntax of the “if”
statement is incorrect.’) (1,11,’E’,’You cannot print integer values
without converting them to strings.’) (1,12,’A’,’Will compile and run
successfully ‘) (1,12,’B’,’Error. ClassA does not define a no-argument
constructor ‘) (1,12,’C’,’Error. There is no code in the constructor
ClassA(int x) ‘) (1,12,’D’,’Error. ClassB does not define a
no-argument constructor ‘) (1,12,’E’,’Error. There is no code in the
class ClassB ‘) (1,13,’A’,'(C) & (E) ‘) (1,13,’B’,'(B),(C) & (D)’)
(1,13,’C’,'(A), (C) & (E)’) (1,13,’D’,’All of these. ‘)
(1,13,’E’,’None of these. ‘) (1,14,’A’,’private ‘) (1,14,’B’,’public’)
(1,14,’C’,’protected’) (1,14,’D’,’private OR protected’)
(1,14,’E’,’All of the above’) (1,15,’A’,'(C), (D) & (E)’)
(1,15,’B’,'(D) ‘) (1,15,’C’,'(A), (D) & (E)’) (1,15,’D’,'(D) & (E) ‘)
(1,15,’E’,'(A)’)

===== users data ====

(1,’1@gmail.com’,”,’George’,’Ronald’,”,”,’Atlanta’,’GA’,’30303′)
(2,’2@gmail.com’,”,’Mary’,’Erikson’,”,”,’San Diego’,’CA’,’91901′)
(3,’3@gmail.com’,”,’John’,’Washington’,”,”,’Atlanta’,’GA’,’30314′)

====enrolls data=====

(1,1,to_date(‘2012/02/15 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/22 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)
(2,1,to_date(‘2012/02/15 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/22 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)
(3,1,to_date(‘2012/02/17 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/24 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)
(1,3,to_date(‘2012/02/17 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/24 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)
(2,3,to_date(‘2012/02/20 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/27 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)
(3,3,to_date(‘2012/02/20 10:00:00’, ‘yyyy/mm/dd
hh24:mi:ss’),to_date(‘2012/02/27 10:00:00’, ‘yyyy/mm/dd hh24:mi:ss’)

===userResponse data====

(1,1,1,’A’) (1,1,2,’B’) (1,1,3,’A’) (1,1,4,’B’) (1,1,5,’N’)
(1,1,6,’C’) (1,1,7,’D’) (1,1,8,’A’) (1,1,9,’B’) (1,1,10,’B’)
(1,1,11,’A’) (1,1,12,’B’) (1,1,13,’A’) (1,1,14,’A’) (1,1,15,’A’)

(2,1,1,’B’) (2,1,2,’B’) (2,1,3,’E’) (2,1,4,’C’) (2,1,5,’D’)
(2,1,6,’A’) (2,1,7,’C’) (2,1,8,’B’) (2,1,9,’B’) (2,1,10,’A’)
(2,1,11,’A’) (2,1,12,’B’) (2,1,13,’B’) (2,1,14,’A’) (2,1,15,’A’)

(3,1,1,’C’) (3,1,2,’C’) (3,1,3,’D’) (3,1,4,’D’) (3,1,5,’A’)
(3,1,6,’A’) (3,1,7,’D’) (3,1,8,’D’) (3,1,9,’A’) (3,1,10,’A’)
(3,1,11,’B’) (3,1,12,’B’) (3,1,13,’A’) (3,1,14,’A’) (3,1,15,’C’)

(1,3,1,’N’) (1,3,2,’A’) (1,3,3,’A’) (1,3,4,’B’) (1,3,5,’B’)
(1,3,6,’C’) (1,3,7,’D’) (1,3,8,’A’) (1,3,9,’A’) (1,3,10,’B’)

(2,3,1,’B’) (2,3,2,’C’) (2,3,3,’A’) (2,3,4,’C’) (2,3,5,’B’)
(2,3,6,’D’) (2,3,7,’D’) (2,3,8,’D’) (2,3,9,’A’) (2,3,10,’A’)

(3,3,1,’B’) (3,3,2,’A’) (3,3,3,’A’) (3,3,4,’B’) (3,3,5,’B’)
(3,3,6,’C’) (3,3,7,’D’) (3,3,8,’A’) (3,3,9,’A’) (3,3,10,’B’)

  • 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-05-31T04:41:15+00:00Added an answer on May 31, 2026 at 4:41 am

    Then it sounds like you want to do an outer join

    select ur.uno, count(q.eno)*5
      from userresponse ur
           left outer join question q
             on(    ur.eno = q.eno 
                and q.correctanswer = ur.response 
                and q.qno = ur.qno 
                and q.eno = '1')
    where ur.uno = '1' 
    group by ur.uno
    

    This will return a row for every row in userresponse with a uno of ‘1’ with a count(*) of 0 if there are no matching rows in question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can I make this work? $current_id=5; SELECT Id FROM table1 WHERE Output='yes' and
I seem to have a problem with this SQL query: SELECT * FROM appts
I'm trying to make a Teradata SQL query that will return the n -th
Currently, this is how I perform a query using node-mysql client.query( sql, function( error,
I have a SQL query that will return over 10,000 rows. Since the client
How i can make this condition en VB.NET If e.KeyCode = [a-zA-Z0-9] Then 'Blah
How can I make this input transparent? <input type=text class=foo> I've tried this but
How can I make this sliding panel example to slide down on mouseover and
How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
How can I make this link use the child selector without changing or removing

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.