how to create aliases of records in oracle sql

31 views Asked by At

I have a table temp with 2 columns roll and attendanceas

roll   attendance 
--------------
1       A
2       P
3       NA

I want to print this table as

roll   attendance 
--------------
1       Absent
2       Present
3       Not applicable
1

There are 1 answers

0
GMB On

You can use a case expression:

select roll, 
    case attendance
        when 'A'  then 'Absent'
        when 'P'  then 'Present'
        when 'NA' then 'Not applicable'
    end as attendance
from mytable