1.

In a database BANK, there are two tables with a sample data given below :                  Table : EMPLOYEEENo.NameSalaryZoneAgeGradeDept1Mona70000East40A102Muktar71000West45B203Nalini60000East26A104Sanaj65000South36A205Surya58000North30B30                     Table: DEPARTMENTDepartmentDNameHOD10Computer120Economics230English5Write SQL queries for the following :(i) To display ENO, ENAME, SALARY and corresponding DNAME of all the employees whose age is between 25 and 35 (both inclusive)(ii) To display DNAME and corresponding ENAME from both tables. Hint: HOD of the DEpARTMENT table should be matched with ENO of the Employee table for getting desired result.(iii) To display ENAME, SALARY ZONE and INCOME TAX (30% of salary) of all the employees with appropriate column headings.

Answer»

(i) SELECT C.ENQ, C.ENAME, C.SALARY FROM EMPLOYEE C, DEPARTMENT D WHERE C.DEPT : D.DEpT AND C.AGE>:25 && C.AGE <:35;

(ii) SELECT D.DNAME,C.ENAME FROM EMPLOYEE C, DEPARTMENT D WHEREC. DEPT=D.DEPT AND C.ENO : D.HOD;

(iii) SELECT ENAME, SALARY ZONE,SALARY*0.3 AS "income tax" FROM EMPLOYEE;



Discussion

No Comment Found

Related InterviewSolutions