Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
5.5k views
in Computer by (38.9k points)
closed by

Write queries (a) to (d) based on the tables EMPLOYEE and DEPARTMENT given below:

Table: EMPLOYEE

Table: DEPARTMENT

DEPTID DEPTNAME FLOORNO
D001 Personal 4
D002 Admin 10
D003 Production 1
D004 Sales 3

(a) To display the average salary of all employees, department wise. 

(b) To display name and respective department name of each employee whose salary is more than 50000.

(c) To display the names of employees whose salary is not known, in alphabetical order. 

(d) To display DEPTID from the table EMPLOYEE without repetition.

1 Answer

+1 vote
by (36.7k points)
selected by
 
Best answer

(a) SELECT AVG(SALARY)

FROM EMPLOYEE 

GROUP BY DEPTID;

(b) SELECT NAME, DEPTNAME 

FROM EMPLOYEE, DEPARTMENT 

WHERE

EMPLOYEE.DEPTID= 

    DEPARTMENT.DEPTID 

 AND SALARY>50000;

(c) SELECT NAME FROM EMPLOYEE 

WHERE SALARY IS NULL 

ORDER BY NAME;

(d) SELECT DISTINCT DEPTID 

FROM EMPLOYEE;

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

...