LIVE Course for free

Rated by 1 million+ students
Get app now
0 votes
74.8k views
in Computer by (78.0k points)

In a Database, there are two tables given below:

                     Table: EMPLOYEE

EnployeeID Name SaIes jobID
E1 Samit Sinha 1100000 102
E2 Vijay Sigh Tomer 1300000 101
E3 Ajay Rajpal 1400000 103
E4 Mohit Ramnani 1250000 102
E5 Shailja Singh 1450000 103

                    Table : JOB

JobID ]obtitle Salary
101 President 200000
102 Vice President 125000
103 Administration Assistant 80000
104 Accounting Manager 70000
105 Accountant 65000
106 Sales Manager 80000

Write 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'.

1 Answer

+1 vote
by (76.1k points) 1 flag
selected by
 
Best 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';

by (50 points)
Thank you so much

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...