EXL Interview Questions| Data Subsets

Question

Suppose that you have table Employee with a column EName which contain Records Employee name(EName) as  A,B,A,A,B,D,C,M,A,

Write a query that will change/Swap the EName A to B and B to A.

in progress 0
Dhruv2301 4 years 3 Answers 1146 views Great Grand Master 0

Answers ( 3 )

  1. select case when EName = “A” then “B” when name=”B” then “A” else EName end Enames from Records;

  2. select
    CASE
    WHEN Ename =’A’ then ‘B’
    WHEN Ename =’B’ then ‘A’
    ELSE Ename
    END as Ename
    FROM Employee;

  3. Select
    CASE
    WHEN Ename = ‘A’ then ‘B’
    WHEN Ename = ‘B’ then ‘A’
    Else Ename
    End as Ename
    from Employee;

Leave an answer

Browse
Browse