The student who got >=40 student is passes and

S_NAME MARKS
ramu 60
ramu 40
ramu 50
karan 30
karan 96
karan 46
out put:
ramu "PASS"
karan "FAIL"

Questions by Rakesh057   answers by Rakesh057

Showing Answers 1 - 15 of 15 Answers

tsreddy

  • Sep 24th, 2014
 

s_name marks is >=40 "pass",else "fail"

  Was this answer useful?  Yes

vb

  • Sep 24th, 2014
 

SELECT SNAME,
CASE WHEN M1>40 AND M2>40 AND M3>40 THEN "PASS"
ELSE
"FAIL"
END AS STATUS
FROM STUDENT ;

  Was this answer useful?  Yes

Jitendra

  • Jan 20th, 2015
 

Code
  1. SELECT NAME,pass FROM (

  2.   SELECT DISTINCT NAME,pass FROM STD WHERE MARKS>=40

  3.   UNION

  4.   SELECT DISTINCT NAME,fail FROM STD WHERE MARKS<40) GROUP BY NAME HAVING COUNT(*)=1

  5.   UNION

  6.   SELECT NAME,fail FROM (

  7.   SELECT DISTINCT NAME,pass FROM STD WHERE MARKS>=40

  8.   UNION

  9.   SELECT DISTINCT NAME,fail FROM STD WHERE MARKS<40) GROUP BY NAME HAVING COUNT(*)<>1


  Was this answer useful?  Yes

Ritesh Kumar

  • Mar 24th, 2015
 

Code
  1. WITH t1

  2.        AS (SELECT   name,

  3.                     COUNT ( result )  AS tt_sub_pass

  4.              FROM   student

  5.             WHERE   result >= 40

  6.             GROUP BY name

  7.             ),

  8.     t2

  9.        AS (SELECT   name, COUNT (result)  tt_sub

  10.              FROM   student

  11.              GROUP BY name )

  12. SELECT   t1.name,

  13.          CASE WHEN t1.tt_sub_pass = t2.tt_sub THEN Pass ELSE Fail END

  14.             AS Final_RES

  15.   FROM   t1, t2

  16.   WHERE t1.name=t2.name

  Was this answer useful?  Yes

Elangovan

  • Aug 12th, 2015
 

Code
  1. SELECT name, CASE WHEN min_marks < 40 THEN FAIL ELSE PASS END AS result FROM (

  2. SELECT name, MIN(marks) AS min_marks FROM student GROUP BY name) a

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions