-1
create table student (
       name varchar2(20),
       s1 number(3),
       s2 number(3),
       s3 number(3)
);

insert into student values('ashok',50, 90, 70);

select name,s1,s2,s3, s1+s2+s3 "Total" 
from student;

select name,s1,s2,s3,if((s1+s2+s3)>(105)){'pass'}   "Total" 
from student 
group by name;

任何人都可以帮助如何打印新列学生看到每个科目是通过还是失败。

4

2 回答 2

1

试试这个:

select distinct
    name,
    s1,
    s2,
    s3,
    case when (s1+s2+s3) > 105 then 'pass'
        else 'fail'
        end as "Total" 
from student;
于 2013-03-14T17:08:49.343 回答
1

那样的话就不能用了。您要查找的句法词是 CASE。

SELECT 
  name, s1,s2,s3,
  CASE
    WHEN (s1+s2+s3)>105 THEN 'Pass'
    ELSE 'Fail'
  END as 'Total'
FROM 
  student
于 2013-03-14T17:09:27.280 回答