Advertisements
Advertisements
Question
Using the table EMPLOYEE from CARSHOWROOM database, write SQL queries for the following:
- Display employee name and the last 2 characters of his EmpId.
- Display designation of employee and the position of character ‘e’ in designation, if present.
Code Writing
Advertisements
Solution
a)
SELECT EmpName, RIGHT(EmpId, 2) AS Last2_Characters FROM EMPLOYEE;
b)
SELECT Designation, INSTR(Designation, 'e') AS Position_of_e FROM EMPLOYEE;
SELECT Designation, CHARINDEX('e', Designation) AS Position_of_e FROM EMPLOYEE;
shaalaa.com
Is there an error in this question or solution?
