Pages

3 August 2016

SQL- Scenario Based Questions PART- 7


SCENARIO:  We have table EMPLOYEE_INFO which contains Employee information. We want to display all characters before '@' in EMAILID field as Name fieldPlease see below in details.

TABLE NAME: EMPLOYEE_INFO

SQL Scenario based questions
Employee_info Table

EXPECTED RESULT:

SQL Scenario based questions
Employee_info Table

SOLUTION:

We can get this done by using the Oracle string functions SUBSTR and INSTR as below .


SELECT EMPID ,EMPNMAE,EMAILID,AGE,GENDER, 
SUBSTR(EMAILID,1,INSTR(EMAILID,'@')-1) Name FROM EMPLOYEE_INFO ;
SQL Scenario based questions
Employee_info Table


No comments:

Post a Comment