English

Using the table EMPLOYEE from CARSHOWROOM database, write SQL queries for the following: a) Display employee name and the last 2 characters of his EmpId.

Advertisements
Advertisements

Question

Using the table EMPLOYEE from CARSHOWROOM database, write SQL queries for the following:

  1. Display employee name and the last 2 characters of his EmpId.
  2. 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?
Chapter 1: Querying and SQL Functions - Intext Questions [Page 10]

APPEARS IN

NCERT Informatics Practices [English] Class 12
Chapter 1 Querying and SQL Functions
Intext Questions | Q 3. | Page 10
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×