1.

In a Database, there are two tables given below:                     Table: EMPLOYEEEnployeeIDNameSaIesjobIDE1Samit Sinha1100000102E2Vijay Sigh Tomer1300000101E3Ajay Rajpal1400000103E4Mohit Ramnani1250000102E5Shailja Singh1450000103                    Table : JOBJobID]obtitleSalary101President200000102Vice President125000103Administration Assistant80000104Accounting Manager70000105Accountant65000106Sales Manager80000Write SQL Queries for the following :(i) To display employee ids, names of employees, job ids with corresponding job titles.(ii) To display names of employees, sales and corresponding job titles who have achieved sales more than 1300000.(ii| To display names and corresponding job titles of those employee who have'SINGH' (anywhere) in their names.(iv) Identify foreign key in the table EMPLOYEE.(v) Write SQL command to change the JOBID to 104 of the Employee with ID as E4 in the table 'EMPLOYEE'.

Answer»

(i) SELECT EMPLOYEEID, NAME, E.JOBID, JOBTITLE FROM EMPLOYEE E, JOB J WHERE E.JOBID = JOBID;

(ii) SELECT NAME,SALES, JOBTITLE FROM EMPLOYEE, JOB WHERE EMPLOYEE.JOBID = JOB.JOBID AND SALES > 1300000;

(iii) SELECT NAME,JOBTITLE FROM EMPLOYEE, JOB WHERE EMPLOYEE.JOSID = ]OB. JOBlD AND NAME LIKE "%SINGIH%";

(iv) JOBID

(v) UPDATE EMPLOYEE SET JOBID = 104 WHERE EMPLOYEEID _'E4';



Discussion

No Comment Found

Related InterviewSolutions